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

Closed
elliottwaldron opened this Issue May 13, 2013 · 3 comments

Comments

Projects
None yet
2 participants

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.

Contributor

jreback commented May 13, 2013

#2893 changed this

maybe we should add a keyword to make this optional instead of sometimes changing the arity

Contributor

jreback commented May 13, 2013

@wesm ?

Contributor

jreback commented May 15, 2013

closeed by #3599

jreback closed this May 15, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment