Open mwaskom opened 3 years ago
Try this instead:
import pandas as pd
s = pd.Series(["a", "a", "b"]).map({"a": (1, 2), "b": (3, 4)}).astype('category')
Output:
0 (1, 2)
1 (1, 2)
2 (3, 4)
dtype: category
Categories (2, object): [(1, 2), (3, 4)]
@sanskarbtw thanks but that is not helpful when operating on an input that (may be) categorical
[x] I have checked that this issue has not already been reported.
[x] I have confirmed this bug exists on the latest version of pandas.
[ ] (optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
Full traceback
```python-traceback --------------------------------------------------------------------------- NotImplementedError Traceback (most recent call last)Expected Output
With an object-typed Series:
Output of
pd.show_versions()