Skip to content
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

Closed
jbrockmendel opened this issue Nov 16, 2017 · 0 comments · Fixed by #18618
Closed

Timestamp.replace should handle DST transition gracefully #18319

jbrockmendel opened this issue Nov 16, 2017 · 0 comments · Fixed by #18618
Labels
Bug Timezones Timezone data dtype
Milestone

Comments

@jbrockmendel
Copy link
Member

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
False
>>> expected.tzinfo.normalize(expected) == expected
True
>>> res.tzinfo.normalize(res) == res
False
>>> 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
Labels
Bug Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants