Skip to content

DataFrame.groupby.count sometimes returns Series instead of DataFrame #3596

Closed
@elliottwaldron

Description

@elliottwaldron

In version 0.11.0

A = DataFrame([[1,1],[2,1]],columns=['X','Y']).groupby('X').count()

returns a DataFrame, when there are 2+ grouping levels...

but,

B = DataFrame([[1,1],[1,1]],columns=['X','Y']).groupby('X').count()

returns a Series, when there is only 1 grouping level.

In version 0.10.0, B would also be a DataFrame.

Don't know if this was by design, but it seems awkward to check the type before using B downstream.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions