From 1cca01fb69f5b4b6ef4008298369471650b40e0f Mon Sep 17 00:00:00 2001 From: Nathan TeBlunthuis Date: Wed, 4 Dec 2024 07:47:47 -0800 Subject: [PATCH] use Path to make directories not os. --- ngrams/term_frequencies.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ngrams/term_frequencies.py b/ngrams/term_frequencies.py index 1253ded..69ad565 100755 --- a/ngrams/term_frequencies.py +++ b/ngrams/term_frequencies.py @@ -133,11 +133,8 @@ def weekly_tf(partition, nullable_schema = True dataset = ds.dataset(f"{input_parquet}/{partition}", format='parquet') - if not os.path.exists(output_10p_sample_path): - os.mkdir(output_10p_sample_path) - - if not os.path.exists(temp_output_tfidf_path): - os.mkdir(temp_output_tfidf_path) + Path(output_10p_sample_path).mkdir(parents=True, exist_ok=True) + Path(temp_output_tfidf_path).mkdir(parents=True, exist_ok=True) ngram_output = partition.replace("parquet","txt")