Skip to content
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

BUG: groupby regression #3433

Closed
jreback opened this issue Apr 23, 2013 · 1 comment
Closed

BUG: groupby regression #3433

jreback opened this issue Apr 23, 2013 · 1 comment
Labels
Groupby Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Apr 23, 2013

in #2893

we changed the groupby behavior to return a series if a simple index is passed in and only have 1 group (rather than return a mi)

I hit this regression as I doing several groupby's on different input, all of which yield multiple groups, except for 1, so I result with a bunch of frames and 1 series

in 0.10.1 this would yield all frames.

so the question is should the automatic magic of 2893 always happen?
e.g. I guess that should create an option to not always reduce the input dims

so my example, shoudl result1 == DataFrame ?

In [6]: df1 = DataFrame(dict(A = range(4), B = 0))

In [7]: def func(dataf):
   ...:     return Series({ dataf.name : 1})
   ...: 

In [8]: result1 = df1.groupby("B").apply(func)

In [9]: result2 = df1.groupby("A").apply(func)

In [10]: result1
Out[10]: 
B   
0  0    1
Name: 0, dtype: int64

In [11]: result2
Out[11]: 
A   
0  0    1
1  1    1
2  2    1
3  3    1
dtype: int64
@jreback
Copy link
Contributor Author

jreback commented Sep 22, 2013

closed by #3599

@jreback jreback closed this as completed Sep 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Groupby Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

No branches or pull requests

1 participant