Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Disallow subsetting columns in groupby with axis=1 #37725

Closed
rhshadrach opened this issue Nov 9, 2020 · 0 comments · Fixed by #37727
Closed

ENH: Disallow subsetting columns in groupby with axis=1 #37725

rhshadrach opened this issue Nov 9, 2020 · 0 comments · Fixed by #37727
Labels
Enhancement Error Reporting Incorrect or improved errors from pandas Groupby
Milestone

Comments

@rhshadrach
Copy link
Member

E.g.

df = pd.DataFrame({'A': [1], 'B': [2], 'C': [3]})
g = df.groupby([0, 0, 1], axis=1)
g[['A', 'B']].sum()

Other than using .size(), I think just about any op will raise. This can be explicitly raised with a more helpful error message when a user subsets the columns.

@rhshadrach rhshadrach added Groupby Error Reporting Incorrect or improved errors from pandas labels Nov 9, 2020
@rhshadrach rhshadrach changed the title Disallow subsetting columns in groupby with axis=1 ENH: Disallow subsetting columns in groupby with axis=1 Nov 9, 2020
@jreback jreback added this to the 1.2 milestone Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Error Reporting Incorrect or improved errors from pandas Groupby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants