pandas.Series.cat.as_unordered#

Series.cat.as_unordered(*args, **kwargs)[source]#

Set the Categorical to be unordered.

Returns:
Categorical

Unordered Categorical.

See also

as_ordered

Set the Categorical to be ordered.

Examples

For pandas.Series:

>>> raw_cat = pd.Categorical(["a", "b", "c", "a"], ordered=True)
>>> ser = pd.Series(raw_cat)
>>> ser.cat.ordered
True
>>> ser = ser.cat.as_unordered()
>>> ser.cat.ordered
False

For pandas.CategoricalIndex:

>>> ci = pd.CategoricalIndex(["a", "b", "c", "a"], ordered=True)
>>> ci.ordered
True
>>> ci = ci.as_unordered()
>>> ci.ordered
False