Skip to content

Commit 5e06afe

Browse files
committed
Added whatsnew note and a DataFrame TestCase
1 parent 0ee36cd commit 5e06afe

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

doc/source/whatsnew/v0.25.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ Indexing
328328
^^^^^^^^
329329

330330
- Improved exception message when calling :meth:`DataFrame.iloc` with a list of non-numeric objects (:issue:`25753`).
331-
-
331+
- Bug in :meth:`_NDFrameIndexer._handle_lowerdim_multi_index_axis0` where KeyError was not raised for a ``MultiIndex``. Now, IndexingError takes precedence over KeyError (:issue:`14885`)
332332
-
333333

334334

pandas/tests/indexing/multiindex/test_getitem.py

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pytest
33

44
from pandas import DataFrame, Index, MultiIndex, Series
5+
from pandas.core.indexing import IndexingError
56
from pandas.util import testing as tm
67

78
# ----------------------------------------------------------------------------
@@ -85,6 +86,7 @@ def test_series_getitem_returns_scalar(
8586
(lambda s: s.__getitem__((2000, 3, 4)), KeyError, r"^356L?$"),
8687
(lambda s: s[(2000, 3, 4)], KeyError, r"^356L?$"),
8788
(lambda s: s.loc[(2000, 3, 4)], KeyError, r"^356L?$"),
89+
(lambda s: s.loc[(2000, 3, 4, 5)], IndexingError, 'Too many indexers'),
8890
(lambda s: s.__getitem__(len(s)), IndexError, 'index out of bounds'),
8991
(lambda s: s[len(s)], IndexError, 'index out of bounds'),
9092
(lambda s: s.iloc[len(s)], IndexError,

0 commit comments

Comments
 (0)