Ensure survey dates are saved in correct order

etta-drone
Dan Howe 6 years ago
parent 769a5d4275
commit 06a75a3adb

@ -143,7 +143,7 @@ def update_survey_output(df, output_dir):
output_dir: directory where csv files are saved output_dir: directory where csv files are saved
Returns: Returns:
None True if current survey is latest, otherwise False
""" """
# Merge current survey with existing data # Merge current survey with existing data
profiles = df['Profile'].unique() profiles = df['Profile'].unique()
@ -168,5 +168,10 @@ def update_survey_output(df, output_dir):
except FileExistsError: except FileExistsError:
pass pass
# Ensure survey dates are in correct order
elev_cols = sorted([col for col in master.columns if 'Elevation' in col])
other_cols = [col for col in master.columns if 'Elevation' not in col]
master = master[other_cols + elev_cols]
# Export updated results # Export updated results
master.to_csv(csv_name, index=False) master.to_csv(csv_name, index=False)

Loading…
Cancel
Save