pandas 1.4.2

Returns
_is_lexsorted(self) -> 'bool'

Returns

bool

Return True if the codes are lexicographically sorted.

Examples

In the below examples, the first level of the MultiIndex is sorted because a<b<c, so there is no need to look at the next level.

This example is valid syntax, but we were not able to check execution
>>> pd.MultiIndex.from_arrays([['a', 'b', 'c'], ['d', 'e', 'f']]).is_lexsorted()
True
This example is valid syntax, but we were not able to check execution
>>> pd.MultiIndex.from_arrays([['a', 'b', 'c'], ['d', 'f', 'e']]).is_lexsorted()
True

In case there is a tie, the lexicographical sorting looks at the next level of the MultiIndex.

This example is valid syntax, but we were not able to check execution
>>> pd.MultiIndex.from_arrays([[0, 1, 1], ['a', 'b', 'c']]).is_lexsorted()
True
This example is valid syntax, but we were not able to check execution
>>> pd.MultiIndex.from_arrays([[0, 1, 1], ['a', 'c', 'b']]).is_lexsorted()
False
This example is valid syntax, but we were not able to check execution
>>> pd.MultiIndex.from_arrays([['a', 'a', 'b', 'b'],
...  ['aa', 'bb', 'aa', 'bb']]).is_lexsorted() True
This example is valid syntax, but we were not able to check execution
>>> pd.MultiIndex.from_arrays([['a', 'a', 'b', 'b'],
...  ['bb', 'aa', 'aa', 'bb']]).is_lexsorted() False
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/indexes/multi.py#1842
type: <class 'function'>
Commit: