Skip to content

COMPAT: tzawareness check behavior is different from stdlib #28507

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

Closed
jbrockmendel opened this issue Sep 18, 2019 · 2 comments · Fixed by #36647
Closed

COMPAT: tzawareness check behavior is different from stdlib #28507

jbrockmendel opened this issue Sep 18, 2019 · 2 comments · Fixed by #36647
Labels
Numeric Operations Arithmetic, Comparison, and Logical operations Timezones Timezone data dtype
Milestone

Comments

@jbrockmendel
Copy link
Member

Timestamp comparisons raise TypeError in some cases where datetimes do not:

ts = pd.Timestamp.now()
ts2 = ts.tz_localize("UTC")
dt = ts.to_pydatetime()
dt2 = ts2.to_pydatetime()

>>> ts == ts2   # <-- TypeError
>>> dt == dt2
False

The datetime comparison will raise for inequalities, just not == or !=.

Changing this behavior would be an API change, but it would likely simplify a bunch of headaches (including a bug in array_equivalent)

@TomAugspurger
Copy link
Contributor

Matching the stdlib makes sense here.

@jreback jreback added the Timezones Timezone data dtype label Sep 20, 2019
@jreback
Copy link
Contributor

jreback commented Sep 20, 2019

yeah this would be ok to change (its sligthly user facing so would need a note)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Numeric Operations Arithmetic, Comparison, and Logical operations Timezones Timezone data dtype
Projects
None yet
3 participants