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

DatetimeIndex comparison tzaware vs naive should raise #18162

Closed
jbrockmendel opened this issue Nov 8, 2017 · 1 comment · Fixed by #18376
Closed

DatetimeIndex comparison tzaware vs naive should raise #18162

jbrockmendel opened this issue Nov 8, 2017 · 1 comment · Fixed by #18376
Labels
Bug Timezones Timezone data dtype
Milestone

Comments

@jbrockmendel
Copy link
Member

>>> dr = pd.date_range('2016-01-01', periods=6)
>>> dz = dr.tz_localize('US/Pacific')
>>> dr < dz
array([ True,  True,  True,  True,  True,  True], dtype=bool)
>>> dr[0] < dz[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pandas/_libs/tslib.pyx", line 1169, in pandas._libs.tslib._Timestamp.__richcmp__
  File "pandas/_libs/tslib.pyx", line 1230, in pandas._libs.tslib._Timestamp._assert_tzawareness_compat
TypeError: Cannot compare tz-naive and tz-aware timestamps

The vectorized comparison should raise too right?

@jreback
Copy link
Contributor

jreback commented Nov 8, 2017

yes this should raise

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.

2 participants