Skip to content

Commit cd44bf4

Browse files
committed
Special case __ne__
1 parent 2c060b4 commit cd44bf4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/core/arrays/categorical.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ def func(self, other):
103103
mask = (self._codes == -1) | (other_codes == -1)
104104
if mask.any():
105105
# In other series, the leads to False, so do that here too
106-
ret[mask] = False
106+
if opname == "__ne__":
107+
ret[mask & (self._codes == other_codes)] = True
108+
else:
109+
ret[mask] = False
107110
return ret
108111

109112
if is_scalar(other):

0 commit comments

Comments
 (0)