Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Inconsistent DataFrame.groupby returned type when grouped value is unique #2893
Comments
|
This is a buggy corner case. I'll have a look |
jreback
referenced
this issue
Apr 2, 2013
Closed
BUG: GH2893 Produce a series on apply if we have a singular series and have a simple index #3239
|
This is fixed in git master. Thanks @jreback |
wesm
closed this
Apr 8, 2013
This was referenced Apr 23, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sv3nd commentedFeb 18, 2013
I am using groupby().apply() to compute new columns in a dataframe, for example like this:
However, if the set of values of the grouped by column ("val1") is unique, the groupby above returns a dataframe as opposed to a Serie, in which case the assignment of the result to a column fails:
As a result, my code is littered by check of uniqueness of grouped by parameter:
Am I taking the wrong approach there? If not, would it be possible to have a consistent returned type?
Thanks!