I have a dataframe as show below,
df =
index value
2014-05-21 10:00:00 13.0
2014-05-21 10:30:00 8.0
2014-05-21 11:00:00 9.0
2014-05-21 11:30:00 7.0
2014-05-21 12:00:00 2.0
....
how can I add a new value 2 in the beginning, and it would be
df =
index value
2014-05-21 09:30:00 2.0 <- new value with new index automatically
2014-05-21 10:00:00 13.0 calculated ( 10 o'clock - 30min(timestep))
2014-05-21 10:30:00 8.0
2014-05-21 11:00:00 9.0
2014-05-21 11:30:00 7.0
2014-05-21 12:00:00 2.0
and
type(df.index) = pandas.core.indexes.datetimes.DatetimeIndex
I would like to add the value in the first index and the datetime would be calculate automatically by the timestep (in this case is 30 min), is there any better way to do it ?
Thanks in advance !