Skip to content

Commit

Permalink
FIX-modin-project#4522: Correct multiindex metadata with groupby
Browse files Browse the repository at this point in the history
Signed-off-by: Devin Petersohn <devin.petersohn@gmail.com>
  • Loading branch information
devin-petersohn committed Jun 2, 2022
1 parent cca9468 commit 13395f0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modin/core/dataframe/algebra/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ def map(
axis=1,
)
other = list(other.columns)
# GH#4522: Vile as this may be, it is necessary to avoid the case where we are
# grouping by columns that were recently added to the data via
# `from_labels`. The internal dataframe doesn't know what to do when
# the label matches a column name.
if len(df.columns.intersection(df.index.names)) > 0:
df = df.reset_index(drop=True)
by_part = other
else:
by_part = by
Expand Down

0 comments on commit 13395f0

Please sign in to comment.