SHOW:
|
|
- or go back to the newest paste.
1 | from datetime import date, timedelta | |
2 | import pandas as pd | |
3 | import numpy as np | |
4 | ||
5 | def empty(start, end): | |
6 | - | dates = np.array([[d.year, d.month, d.day] for d in [start + timedelta(d) for d in range((end-start).days+1)]]).T |
6 | + | cols = np.array([[d.year, d.month, d.day, 0] for d in [start + timedelta(d) for d in range((end-start).days+1)]]).T |
7 | - | return pd.DataFrame({'year': dates[0], 'month': dates[1], 'day': dates[2]}) |
7 | + | return pd.DataFrame({'year': cols[0], 'month': cols[1], 'day': cols[2], 'data': cols[3]}).set_index(['year', 'month', 'day']) |
8 | ||
9 | empty(date(2017, 7, 1), date(2018, 7, 1)) |