Skip to content

Commit 43989fd

Browse files
committed
DOC: xref #13112, add back lexsorting example
1 parent af7bdd3 commit 43989fd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

doc/source/advanced.rst

+13
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,13 @@ return a copy of the data rather than a view:
528528
jim joe
529529
1 z 0.64094
530530
531+
Furthermore if you try to index something that is not fully lexsorted, this can raise:
532+
533+
.. code-block:: ipython
534+
535+
In [5]: dfm.loc[(0,'y'):(1, 'z')]
536+
KeyError: 'Key length (2) was greater than MultiIndex lexsort depth (1)'
537+
531538
The ``is_lexsorted()`` method on an ``Index`` show if the index is sorted, and the ``lexsort_depth`` property returns the sort depth:
532539

533540
.. ipython:: python
@@ -542,6 +549,12 @@ The ``is_lexsorted()`` method on an ``Index`` show if the index is sorted, and t
542549
dfm.index.is_lexsorted()
543550
dfm.index.lexsort_depth
544551
552+
And now selection works as expected.
553+
554+
.. ipython:: python
555+
556+
dfm.loc[(0,'y'):(1, 'z')]
557+
545558
Take Methods
546559
------------
547560

0 commit comments

Comments
 (0)