I have a normal df.index that I would like to add some hours to it.
In [1]: test[1].index
Out[2]:
<class 'pandas.tseries.index.DatetimeIndex'>
[2010-03-11, ..., 2014-08-14]
Length: 52, Freq: None, Timezone: None
This is how the first element looks like:
In [1]: test[1].index[0]
Out[2]: Timestamp('2010-03-11 00:00:00')
So I try this to add the hours:
In [1]: test[1].index[0] + pd.tseries.timedeltas.to_timedelta(16, unit='h')
However I get this:
Out[2]: Timestamp('2010-03-11 00:00:00.000000016')
But I would like to get this:
Out[2]: Timestamp('2010-03-11 16:00:00')
What I am missing?. The enviroment is Anaconda (latest) Python 2.7.7, iPython 2.2
Thanks a lot
question from:
https://stackoverflow.com/questions/25797245/how-to-properly-add-hours-to-a-pandas-tseries-index-datetimeindex 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…