-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.py
More file actions
28 lines (23 loc) · 776 Bytes
/
utils.py
File metadata and controls
28 lines (23 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pandas as pd
import matplotlib.pyplot as plt
def extract_dt(data):
data['time'] += ':00'
data['datetime'] = pd.to_timedelta(data['time'])
data['hour'] = data['datetime'].dt.seconds // 3600
return data
def plot_curves(day_range, month, year):
data = {}
for day in day_range:
date = '%02d-%02d-%d' % (day, month, year)
data['df%02d' % day] = extract_dt(pd.read_csv('SLDC_Data/%d/%02d/%s.csv' % (year, month, date)))
data['df%02d' % day]['date'] = date
plt.figure(figsize=(20, 10))
date = []
for i in sorted(data):
frame = data[i]
plt.plot(frame['time'], frame['value'])
date.append(frame['date'][0])
plt.legend(date, loc='best')
plt.show()
if __name__=='main':
pass