-
[x] I have checked that this issue has not already been reported.
-
[x] I have confirmed this bug exists on the latest version of pandas.
-
[ ] (optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
import pandas as pd
i = pd.date_range('2020-03-28', periods=4, freq='D', tz='Europe/Berlin')
i # DatetimeIndex(['2020-03-28 00:00:00+01:00', '2020-03-29 00:00:00+01:00', '2020-03-30 00:00:00+02:00', '2020-03-31 00:00:00+02:00'], dtype='datetime64[ns, Europe/Berlin]', freq='D')
i[0] + i.freq == i[1] #True
i[2] + i.freq == i[3] #True
i[1] + i.freq == i[2] #False (!)
Problem description
Variably-spaced timestamps are not handled well, if the variation is caused by DST. The result of i[1] + i.freq
is
Timestamp('2020-03-30 01:00:00+0200', tz='Europe/Berlin', freq='D')
, whereas
Timestamp('2020-03-30 00:00:00+0200', tz='Europe/Berlin', freq='D')
was expected.
This is in contrast to timestamps where the variation is caused by e.g. months being different lengths, which are handled correctly.
Output of pd.show_versions()
Comment From: jbrockmendel
cc @mroeschke this looks like a bug; i guess for now dti.freq should be None until we get a DayDST offset?
Comment From: mroeschke
Ya generally Timestamps
+ offsets
with DST is generally still not well supported
Comment From: jbrockmendel
edited the title