-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
API/DOC: clean up DataFrame.groupby.apply #22545
Comments
@h-vetinari : Very thorough of you to do this! Keep at it! |
@gfyoung Thanks. Could you maybe add the tags for groupby and API Design as well, please? The groupby-issues especially are so numerous that it's easier to only search within the tagged ones... |
@h-vetinari a lot of cleanup in/around groupby.apply has occurred recently. can you see if any of the bugs/inconsistencies here have been addressed? |
Similar to #20420, I see inconsistent output with groupby+apply+diff. If the groupby results in exactly 2 records, the output from applying diff is a transposed DataFrame. Otherwise, if there are more than 2 records in the groupby, the output is a Series. I can make a separate issue with code snippet if needed but I think my issue might be fixed if #20420 is fixed. |
I'm very often working with
df.groupby.apply()
, and there are many confusing (sometimes wrong) aspects about the behaviour of the output, particularly regarding what happens with the index of the output.v.0.23
cleaned up big parts of theapply
API, but there's still a lot left...Ideally, I wish there'd be a sort of matrix (not necessarily in the following form) in the documentation - and implemented by the API - along the following lines
For
as_index=True
:For
as_index=False
:Currently, the behaviour is much, much more complicated / inconsistent / wrong. I'm trying to fill corresponding tables with the current behaviour and some issue xrefs, but it's by far not complete yet:
For
as_index=True
:For
as_index=False
:Some xrefs: #20420, #22541, #22542, #22546
The text was updated successfully, but these errors were encountered: