Export daily means

master
Dan Howe 6 years ago
parent 8914c8b06b
commit a8f558079f

@ -258,7 +258,7 @@ def extract_records(input_dir, output_dir, clean_up=False):
os.makedirs(output_dir, exist_ok=True)
# Create master dataframe
periods = ['all', 'weekly']
periods = ['all', 'daily', 'weekly']
master = {}
for period in periods:
master[period] = pd.DataFrame()
@ -315,7 +315,12 @@ def extract_records(input_dir, output_dir, clean_up=False):
# Append to master dataframe
for period in periods:
if period == 'weekly':
if period == 'daily':
# Resample to daily timestamps
df = df.resample('1d').mean()
df['Date time'] = df.index
elif period == 'weekly':
# Resample to weekly timestamps
df = df.resample('1w').mean()
df['Date time'] = df.index

Loading…
Cancel
Save