New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp.replace should handle DST transition gracefully #18319

jbrockmendel opened this Issue Nov 16, 2017 · 0 comments


None yet
3 participants

jbrockmendel commented Nov 16, 2017

In fairness, datetime doesn't handle this any better, and differing from that behavior could be considered a drawback.

>>> ts = pd.Timestamp('1929-05-05', tz='US/Eastern')
>>> res = ts.replace(month=4)
>>> expected = pd.Timestamp('1929-04-05', tz='US/Eastern')
>>> res == expected
>>> expected.tzinfo.normalize(expected) == expected
>>> res.tzinfo.normalize(res) == res
>>> res.tzinfo.normalize(res)
Timestamp('1929-04-04 22:00:00-0500', tz='US/Eastern')

Is this a feature and not a bug for some reason I'm missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment