I am trying to recalculate the datetime index into hourly data. I also want oversampling before the end of the month.
So the following is given df:
data = np.arange(6).reshape(3,2)
rng = ['Jan-2016', 'Feb-2016', 'Mar-2016']
df = pd.DataFrame(data, index=rng)
df.index = pd.to_datetime(df.index)
0 1
2016-01-01 0 1
2016-02-01 2 3
2016-03-01 4 5
I know that I can convert this to an hourly index: df = df.resample('H').ffill()However, when I call df, it is truncated to 2016-03-01. I essentially do an index from 1/1/2016to 3/31/2016with hourly granularity.
How can I extend this until the end of the month 2015-03-31, given that the last index is the beginning of the month.
source
share