If I do
import pandas as pd
pd.to_datetime("2020-03-08") + pd.to_timedelta('1D')
I get Timestamp('2020-03-09 00:00:00') as expected.
But when I try with a timezone aware datatype..
pd.to_datetime("2020-03-08").tz_localize('America/New_York') + pd.to_timedelta('1D')
I get Timestamp('2020-03-09 01:00:00-0400', tz='America/New_York') which is one hour after midnight.
This actually makes sense when you realise that 2020-03-08 is the day the clocks move forward for daylight savings time, and the day is only 23 hours long. But I have a use case where I want a time delta that is always one "local time" day long.
So is there a way of creating a "local time aware" timedelta object so that '1D' represents a calendar day whether the day is 23, 24 or 25 hours long?