pyspark.pandas.CategoricalIndex.as_unordered

CategoricalIndex.as_unordered(inplace: bool = False) → Optional[pyspark.pandas.indexes.category.CategoricalIndex][source]

Set the Categorical to be unordered.

Parameters
inplacebool, default False

Whether or not to set the ordered attribute in-place or return a copy of this categorical with ordered set to False.

Returns
CategoricalIndex or None

Unordered Categorical or None if inplace=True.

Examples

>>> idx = ps.CategoricalIndex(list("abbccc")).as_ordered()
>>> idx  
CategoricalIndex(['a', 'b', 'b', 'c', 'c', 'c'],
                 categories=['a', 'b', 'c'], ordered=True, dtype='category')
>>> idx.as_unordered()  
CategoricalIndex(['a', 'b', 'b', 'c', 'c', 'c'],
                 categories=['a', 'b', 'c'], ordered=False, dtype='category')