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

DTI/TDI comparison ops with incompatible types #19804

Closed
jbrockmendel opened this issue Feb 21, 2018 · 2 comments
Closed

DTI/TDI comparison ops with incompatible types #19804

jbrockmendel opened this issue Feb 21, 2018 · 2 comments
Labels
Bug Datetime Datetime data dtype Numeric Operations Arithmetic, Comparison, and Logical operations Timedelta Timedelta data type

Comments

@jbrockmendel
Copy link
Member

Timestamp and Timedelta comparisons against non-Timestamp/Timedelta-like others return False for __eq__, True for __ne__ and raise TypeError for inequalities. DatetimeIndex follows this convention in some cases, but there are paths that will end up raising instead of returning True/False. TimedeltaIndex doesn't follow this convention at all.

Is the current hodge-podge intentional? If not I can put together a PR to ensure that index.__cmp__(other) == np.array([index[n].__cmp__(other) for n in range(len(index))])

@jreback
Copy link
Contributor

jreback commented Feb 21, 2018

the timestamp/timedelta behavior is correct

ne/eq should always work
inequality always raise

for non compat types
numpy and python both follow this

@jbrockmendel
Copy link
Member Author

This got fixed a ways back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype Numeric Operations Arithmetic, Comparison, and Logical operations Timedelta Timedelta data type
Projects
None yet
Development

No branches or pull requests

4 participants