Skip to content

Commit

Permalink
Follow up PR: pandas-dev#28097 Simplify branch statement
Browse files Browse the repository at this point in the history
  • Loading branch information
proost committed Oct 27, 2019
1 parent 08ab156 commit c6e8611
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1304,14 +1304,13 @@ def _get_grouper_for_level(self, mapper, level):
codes[mask] = ok_codes
codes[~mask] = -1

if len(uniques) < len(level_index):
# Remove unobserved levels from level_index
level_index = level_index.take(uniques)
grouper = level_index.take(codes, fill_value=True)
else:
if len(uniques) < len(level_index):
# Remove unobserved levels from level_index
level_index = level_index.take(uniques)

if len(level_index):
grouper = level_index.take(codes)
else:
grouper = level_index.take(codes, fill_value=True)

return grouper, codes, level_index

Expand Down

0 comments on commit c6e8611

Please sign in to comment.