From 769a5d42758847befe229bc34fd18adc9fba558e Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Fri, 20 Jul 2018 08:25:48 +1000 Subject: [PATCH] Create output directory if required --- survey_tools.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/survey_tools.py b/survey_tools.py index d685075..c9eec31 100644 --- a/survey_tools.py +++ b/survey_tools.py @@ -162,5 +162,11 @@ def update_survey_output(df, output_dir): current_survey_col = current_profile.columns[-1] master[current_survey_col] = current_profile[current_survey_col].values + # Prepare output directory + try: + os.makedirs(output_dir) + except FileExistsError: + pass + # Export updated results master.to_csv(csv_name, index=False)