Skip to content

Conversation

@rhshadrach
Copy link
Member

@rhshadrach rhshadrach commented Nov 12, 2020

The groupby code that calls Series.__getitem__ catches KeyError and TypeError. If a tuple is fed into an Index that is not a MultiIndex, we were raising a ValueError but KeyError seems more appropriate here and also fixes the regression.

While working on this, I found that we raise a KeyError inappropriately if an index of tuples contains duplicates, however this exists back in 1.0.x and so is not part of the regression. I've opened #37800 for this.

@rhshadrach rhshadrach added Indexing Related to indexing on series/frames, not to indexes themselves Regression Functionality that used to work in a prior pandas version Series Series data structure labels Nov 13, 2020
@rhshadrach rhshadrach added this to the 1.1.5 milestone Nov 13, 2020
@jreback jreback merged commit be03eb1 into pandas-dev:master Nov 14, 2020
@jreback
Copy link
Contributor

jreback commented Nov 14, 2020

thanks @rhshadrach keem em coming!

@simonjayhawkins
Copy link
Member

@meeseeksdev backport 1.1.x

@lumberbot-app

This comment has been minimized.

simonjayhawkins pushed a commit to simonjayhawkins/pandas that referenced this pull request Nov 14, 2020
simonjayhawkins added a commit that referenced this pull request Nov 14, 2020
…as a tuple name fails (#37829)

Co-authored-by: Richard Shadrach <[email protected]>
@rhshadrach rhshadrach deleted the series_groupby_regression branch November 24, 2020 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Indexing Related to indexing on series/frames, not to indexes themselves Regression Functionality that used to work in a prior pandas version Series Series data structure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Series.groupby() fails in pandas 1.1.4 when index has tuple name.

4 participants