Skip to content

Commit 3b6aacb

Browse files
author
HH
committed
change syntax more clearly
1 parent 66b8e42 commit 3b6aacb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

doc/source/whatsnew/v0.25.1.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Indexing
8585
- Bug in partial-string indexing returning a NumPy array rather than a ``Series`` when indexing with a scalar like ``.loc['2015']`` (:issue:`27516`)
8686
- Break reference cycle involving :class:`Index` and other index classes to allow garbage collection of index objects without running the GC. (:issue:`27585`, :issue:`27840`)
8787
- Fix regression in assigning values to a single column of a DataFrame with a ``MultiIndex`` columns (:issue:`27841`).
88-
-
88+
- ``IndexError`` would not raise if missing data in index (:issue:`20519`).
8989

9090
Missing
9191
^^^^^^^

pandas/core/indexes/multi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ def _get_grouper_for_level(self, mapper, level):
12791279
# Remove unobserved levels from level_index
12801280
level_index = level_index.take(uniques)
12811281

1282-
if not level_index.tolist():
1282+
if not len(level_index):
12831283
grouper = level_index
12841284
else:
12851285
grouper = level_index.take(codes)

0 commit comments

Comments
 (0)