Closed
Description
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