Skip to content

Commit 891be85

Browse files
committed
Doc fixes
1 parent 03f6c42 commit 891be85

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

doc/source/advanced.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -528,12 +528,14 @@ return a copy of the data rather than a view:
528528
jim joe
529529
1 z 0.64094
530530
531+
.. _advanced.unsorted:
532+
531533
Furthermore if you try to index something that is not fully lexsorted, this can raise:
532534

533535
.. code-block:: ipython
534536
535537
In [5]: dfm.loc[(0,'y'):(1, 'z')]
536-
KeyError: 'Key length (2) was greater than MultiIndex lexsort depth (1)'
538+
UnsortedIndexError: 'Key length (2) was greater than MultiIndex lexsort depth (1)'
537539
538540
The ``is_lexsorted()`` method on an ``Index`` show if the index is sorted, and the ``lexsort_depth`` property returns the sort depth:
539541

doc/source/whatsnew.rst

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ What's New
1818

1919
These are new features and improvements of note in each release.
2020

21+
.. include:: whatsnew/v0.20.0.txt
22+
2123
.. include:: whatsnew/v0.19.2.txt
2224

2325
.. include:: whatsnew/v0.19.1.txt

doc/source/whatsnew/v0.20.0.txt

+5-3
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ Other enhancements
4141

4242
- ``pd.read_excel`` now preserves sheet order when using ``sheetname=None`` (:issue:`9930`)
4343

44-
- New ``UnsortedIndexError`` (subclass of ``KeyError``) thrown when indexing into an
45-
unsorted MultiIndex (:issue:'11897`)
44+
- New ``UnsortedIndexError`` (subclass of ``KeyError``) thrown when indexing/slicing into an
45+
unsorted MultiIndex (:issue:`11897`). This allows differentiation between errors due to lack
46+
of sorting or an incorrect key. See :ref:`here <advanced.unsorted>`
4647

47-
- Change message when indexing via a boolean ``Series`` that has an incompatible index (:issue:`14491`)
48+
- Change error message text corresponding to error raised when indexing via a
49+
boolean ``Series`` that has an incompatible index (:issue:`14491`)
4850

4951

5052
.. _whatsnew_0200.api_breaking:

pandas/core/common.py

+3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ class UnsupportedFunctionCall(ValueError):
9898

9999

100100
class UnsortedIndexError(KeyError):
101+
""" This error is raised when attempting to get a slice of a MultiIndex
102+
and the index has not been lexsorted.
103+
"""
101104
pass
102105

103106

0 commit comments

Comments
 (0)