You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BUG: Fix for comparisons of categorical and an scalar not in categories, xref GH9836
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`.
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.16.1.txt
+2
Original file line number
Diff line number
Diff line change
@@ -124,3 +124,5 @@ Bug Fixes
124
124
- Bug in which ``SparseDataFrame`` could not take `nan` as a column name (:issue:`8822`)
125
125
126
126
- Bug in unequal comparisons between a ``Series`` of dtype `"category"` and a scalar (e.g. ``Series(Categorical(list("abc"), categories=list("cba"), ordered=True)) > "b"``, which wouldn't use the order of the categories but use the lexicographical order. (:issue:`9848`)
127
+
128
+
- Bug in unequal comparisons between categorical data and a scalar, which was not in the categories (e.g. ``Series(Categorical(list("abc"), ordered=True)) > "d"``. This returned ``False`` for all elements, but now raises a ``TypeError``. Equality comparisons also now return ``False`` for ``==`` and ``True`` for ``!=``. (:issue:`9848`)
0 commit comments