Skip to content

Commit 8bfd2f5

Browse files
jorisvandenbosscheJulianWgs
authored andcommitted
COMPAT: make Categorical._codes settable again (pandas-dev#40580)
1 parent 485f46f commit 8bfd2f5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pandas/core/arrays/categorical.py

+4
Original file line numberDiff line numberDiff line change
@@ -1756,6 +1756,10 @@ def to_dense(self):
17561756
def _codes(self) -> np.ndarray:
17571757
return self._ndarray
17581758

1759+
@_codes.setter
1760+
def _codes(self, value: np.ndarray):
1761+
self._ndarray = value
1762+
17591763
def _from_backing_data(self, arr: np.ndarray) -> Categorical:
17601764
assert isinstance(arr, np.ndarray)
17611765
assert arr.dtype == self._ndarray.dtype

0 commit comments

Comments
 (0)