CategoricalIndex.
as_ordered
Set the Categorical to be ordered.
Whether or not to set the ordered attribute in-place or return a copy of this categorical with ordered set to True.
Ordered Categorical or None if inplace=True.
inplace=True
Examples
>>> idx = ps.CategoricalIndex(list("abbccc")) >>> idx CategoricalIndex(['a', 'b', 'b', 'c', 'c', 'c'], categories=['a', 'b', 'c'], ordered=False, dtype='category')
>>> idx.as_ordered() CategoricalIndex(['a', 'b', 'b', 'c', 'c', 'c'], categories=['a', 'b', 'c'], ordered=True, dtype='category')