Skip to content

BUG: groupby.agg fails when input has duplicate columns and dict input #55041

Closed
@rhshadrach

Description

@rhshadrach
df = DataFrame(
    [[1, 2, 3, 4], [1, 3, 4, 5], [2, 4, 5, 6]],
    columns=["a", "b", "c", "c"],
)
gb = df.groupby("a")
gb.agg({"c": "sum"})

raises AttributeError: 'DataFrame' object has no attribute 'name'. Did you mean: 'rename'?

I would expect it to aggregate both of the columns named "c".

Metadata

Metadata

Assignees

No one assigned

    Labels

    ApplyApply, Aggregate, Transform, MapBugGroupby

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions