Skip to content

Commit e92568b

Browse files
testing
1 parent 64b6d6c commit e92568b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/indexes/category.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,9 @@ def where(self, cond, other=None):
507507
# 3. Rebuild CategoricalIndex.
508508
if other is None:
509509
other = self._na_value
510-
cat = CategoricalIndex(self.values.where(cond, other),
510+
copied_cat = Categorical(self.values, dtype=self.dtype)
511+
copied_cat[cond] = other
512+
cat = CategoricalIndex(copied_cat,
511513
dtype=self.dtype)
512514
return self._shallow_copy(cat, **self._get_attributes_dict())
513515

0 commit comments

Comments
 (0)