I want to adjust the timestamp of my time series dataframe
. The existing date-time of the first row is 01/01/2001 04:30:00
. I want to change it to 30/11/2011 19:30:00
, and the rest (up to five years of 5 minutes record) should follow.
This is my code:
df['NewDateTime'] = df['DateTime'] + pd.Timedelta('3985 D')
df['NewDateTime'] = df['NewDateTime'] + pd.Timedelta('15h')
This gives correct result for the first rows. But I believe that the result will be wrong if the timestamp adjustment span is more than 4 years because there are Februaries with the number of days of 28 while other Februaries have 29 days.
How is the correct way to do it?
This is the data.