The warning in the title is produced by pandas 0.21.0 on Python 3.6.3 with code such as pd.Series(["a", "b", "b"]).astype("category", categories = ["a", "b", "c"]). How exactly is one supposed to write this now?
The warning in the title is produced by pandas 0.21.0 on Python 3.6.3 with code such as pd.Series(["a", "b", "b"]).astype("category", categories = ["a", "b", "c"]). How exactly is one supposed to write this now?
pd.Categorical(pd.Series(['a','b','b']), categories = ['a', 'b', 'c'])
Also you can use the ordered parameter to create a categorical hierarchy
result = pd.Categorical(pd.Series(['a','b','b']), categories = ['a', 'b', 'c'], ordered = True)
Update to convert to Series dtype
pd.Series(result)