Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
elliottwaldron opened this issue May 13, 2013 · 3 comments
Closed
Milestone

Comments

@elliottwaldron
Copy link

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.

@jreback
Copy link
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

@jreback
Copy link
Contributor

jreback commented May 13, 2013

@wesm ?

@jreback
Copy link
Contributor

jreback commented May 15, 2013

closeed by #3599

@jreback jreback closed this as completed May 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants