-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
API: relax categorical equality when comparing against object #8938
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
Comments
cc @JanSchulz I think the merging is the correct behavior (@immerrr and I worked on this for a while to make it correct). as a single categorical merging with either an equal categorical (meaning the same categories) or an object array is OK, though you do lose the 'character', meaning the Categorical of the dtypes. But this is like downgrading a type, e.g. going from integer to float when you are merging a float. So I don't think this is that big of a deal. Note that we could try to infer the categorical if possible after merging (which is possible if the object happens to not contain new categories). |
Agreed, the first example should work. |
Yup, it seems natural to enable that. |
The problem is when there is a custom ordering, then a object array with In my head I think about categorical elements as a new type and under python 3, different types are not comparable per default and I went with that thought in the implementation. |
@JanSchulz I agree with you on the ordering case and < or >. Clearly they are not comparable. However, merging and equality are are about positional equality. and we already support comparisons against a scalar
I'll put up a PR |
Ah, ok, now I understand: more or less merge treats each value in the "to-be-merged" object array as a single value, so the scalar cases applies. |
from SO
The text was updated successfully, but these errors were encountered: