Skip to content

BUG: groupby.transform confused about index #9700

Closed
@dsm054

Description

@dsm054

Under some circumstances, transform is getting confused about what the output index should be:

>>> df = pd.DataFrame({"c1": [1], "c2": [2]})
>>> df
   c1  c2
0   1   2
>>> df.groupby('c1').transform(sum)
   c2
0 NaN
1   2

I haven't chased down why, but since we have

>>> df.groupby('c1').transform(lambda x: sum(x))
   c2
0   2

it must be another fast-path problem, like #9697.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions