Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import date, timedelta
- import pandas as pd
- import numpy as np
- def empty(start, end):
- 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
- return pd.DataFrame({'year': cols[0], 'month': cols[1], 'day': cols[2], 'data': cols[3]}).set_index(['year', 'month', 'day'])
- empty(date(2017, 7, 1), date(2018, 7, 1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement