API: comparisons of categorical data and (scalar or list-like) #8995
Labels
API Design
Bug
Categorical
Categorical Data Type
Closing Candidate
May be closeable, needs more eyeballs
Numeric Operations
Arithmetic, Comparison, and Logical operations
From #8946:
If
cat > scalar
is allowed andcat == list
also because it basically is doing a comparison of each line as if it was the scalar case, then by that logic,cat > list
should also be allowed: each row in that comparison would treat the element from the list as a scalar.On the other hand a scalar comparison with the categorical makes only sense if the scalar can be treated as a category (for any other value, it's basically a "not of the same type" comparison, which would raise on python3), so the scalar must be in
categories
and this should not work:Oh, one more thing: according to that thought,
df.b == 2
(-> The "equality" case) should also NOT work, because2
is not incategories
and therefore a "different type".Current code results in this:
this is actually consistent (e.g. it returns False). On a comparison it shouldn't raise so this is a reasonable result. I think this is de-facto like the following and is useful.
The text was updated successfully, but these errors were encountered: