Skip to content

BUG: inconsistent name for returned Series in groupby #12363

@jreback

Description

@jreback

I would think [7] and [8] would be identical. Note this is true for all ops I have looked at, so it is a general issue.

In [6]: df = DataFrame({'A': ['foo', 'bar', 'foo', 'bar', 'foo', 'bar', 'foo', 'foo'], 'B': ['one', 'one', 'two', 'two', 'two', 'two', 'one', 'two'], 'C': np.random.randn(8) + 1.0, 'D': np.arange(8)}) In [7]: df.groupby(['A']).B.count() Out[7]: A bar 3 foo 5 Name: B, dtype: int64 In [8]: df.B.groupby(df.A).count() Out[8]: A bar 3 foo 5 dtype: int64 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions