Skip to content

Fix for comparisons of categorical and an scalar not in categories #9864

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

Conversation

jankatins
Copy link
Contributor

Up to now, a comparison of categorical data and a scalar, which
is not in the categories would return False for all elements when
it should raise a TypeError, which it now does.

Also fix that != comparisons would return False for all elements
when the more logical choice would be True.

Fixes the raised issue in #9836 (comment)

Up to now, a comparison of categorical data and a scalar, which
is not in the categories would return `False` for all elements when
it should raise a `TypeError`, which it now does.

Also fix that `!=` comparisons would return `False` for all elements
when the more logical choice would be `True`.
@kay1793
Copy link

kay1793 commented Apr 12, 2015

Still asking why equality doesn't raise when comparing with a non-existing category.

@shoyer
Copy link
Member

shoyer commented Apr 12, 2015

@kay1793 This is consistent with what Python does for non-comparable types:

# python 3
In [1]: 'foo' == 123
Out[1]: False

In [2]: 'foo' > 123
TypeError: unorderable types: str() > int()

@kay1793
Copy link

kay1793 commented Apr 13, 2015

thanks.

@jreback jreback added Bug Categorical Categorical Data Type labels Apr 13, 2015
@jreback jreback added this to the 0.16.1 milestone Apr 13, 2015
@jreback
Copy link
Contributor

jreback commented Apr 13, 2015

merged via 35b20d8

thank you!

@jreback jreback closed this Apr 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Categorical Categorical Data Type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants