polars.Series.cat.uses_lexical_ordering#

Series.cat.uses_lexical_ordering() bool[source]#

Return whether or not the series uses lexical ordering.

This can be set using set_ordering().

Warning

This API is experimental and may change without it being considered a breaking change.

See also

set_ordering

Examples

>>> s = pl.Series(["b", "a", "b"]).cast(pl.Categorical)
>>> s.cat.uses_lexical_ordering()
False
>>> s = s.cat.set_ordering("lexical")
>>> s.cat.uses_lexical_ordering()
True