pandas.CategoricalIndex.ordered#

property CategoricalIndex.ordered[source]#

Whether the categories have an ordered relationship.

This property returns True if the categories are ordered, meaning they have a meaningful order that allows comparison operations.

See also

CategoricalIndex.as_ordered

Set the CategoricalIndex to be ordered.

CategoricalIndex.as_unordered

Set the CategoricalIndex to be unordered.

Examples

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