Skip to content

Commit 8e1dd1e

Browse files
proostjreback
authored andcommitted
Follow up PR: #28097 Simplify branch statement (#29243)
1 parent d12c2c6 commit 8e1dd1e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/core/indexes/multi.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1261,10 +1261,10 @@ def _get_grouper_for_level(self, mapper, level):
12611261
# on the output of a groupby doesn't reflect back here.
12621262
level_index = level_index.copy()
12631263

1264-
if len(level_index):
1265-
grouper = level_index.take(codes)
1266-
else:
1264+
if level_index._can_hold_na:
12671265
grouper = level_index.take(codes, fill_value=True)
1266+
else:
1267+
grouper = level_index.take(codes)
12681268

12691269
return grouper, codes, level_index
12701270

0 commit comments

Comments
 (0)