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
We'd need to recode the source categorical's codes to the target's.
In [6]: a=pd.Categorical(['a', 'b'], categories=['b', 'a'])
In [7]: b=pd.Categorical(['a', 'b'], categories=['a', 'b'])
In [8]: a[[True, False]] =b[[True, False]]
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-8-9693ad7c05cc> in <module>
----> 1 a[[True, False]] = b[[True, False]]
~/sandbox/pandas/pandas/core/arrays/categorical.py in __setitem__(self, key, value)
2082 if isinstance(value, Categorical):
2083 if not value.categories.equals(self.categories):
-> 2084 raise ValueError("Cannot set a Categorical with another, "
2085 "without identical categories")
2086
ValueError: Cannot set a Categorical with another, without identical categories
The text was updated successfully, but these errors were encountered:
We'd need to recode the source categorical's codes to the target's.
The text was updated successfully, but these errors were encountered: