-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Aggregate fails with mixed types in grouping series #16916
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
Comments
simpler example
so to clean up some things. I would move |
@nreeve17 : How do these solutions sound to you? Did the quick-fix work for you BTW? |
@gfyoung yes I tried that quick fix and it worked. I ran all the tests on pandas with the modification to groupby.py and nothing seems to be broken. Should I add a test case and submit a pull request? |
@nreeve17 : Awesome that that worked! However, a more robust solution (and one that will be more likely to be merged) is to do a |
Fixes issue pandas-dev#16916, where using aggregate on a mixed type grouping vector fails. Added test in test_aggregate.py to ensure that the bug is fixed.
Fixes issue pandas-dev#16916, where using aggregate on a mixed type grouping vector fails. Added test in test_aggregate.py to ensure that the bug is fixed.
This looks to be fixed on master. Could use a test.
|
Code Sample, a copy-pastable example if possible
This is the exception and traceback that the code above returns:
Problem description
If a grouping vector is of mixed type and aggregate is used after groupby(...), an exception will be raised. The source code will get to this line and fails because sorted() does not support mixed types.
Expected Output
This is what we would expect to see if the exception was not raised. This output was achieved by using a column in groupby that is of a single type. In this instance, 2 was changed to a string
Output of
pd.show_versions()
cc @ElDeveloper
The text was updated successfully, but these errors were encountered: