Skip to content

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

Closed
@rhshadrach

Description

@rhshadrach

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions