-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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: ban mutation within groupby.apply #12653
Comments
agreed this is a footgun. brainstorming how to implement:
|
@jbrockmendel with the contextmanager, are you thinking doing a comparison after the apply call to see if the objects involved changed? Is there a way to avoid a copy here? |
I am thinking of setting the |
I think of this issue applying to all UDF functions (apply, aggregate, transform, filter) on all pandas objects. @jbrockmendel - would you support just adding to the docs without the context manager? This would perhaps raise some awareness and I think doesn't require a deprecation, and gives a place we can point to when issues are reported. |
I think thats probably our best bet. Something to point out when people inevitably open issues about this. |
I'm +1 on closing this, I don't believe the context manager is necessary. |
Looks like this has been clearly documented in https://pandas.pydata.org/pandas-docs/stable/user_guide/gotchas.html#gotchas-udf-mutation by #39762 - closing then, but please let me know if I've misunderstood, or if you believe that just documenting this isn't enough of a solution |
xref #8662
xref #12652
This makes pandas code jump thru hoops and is a complete anti-pattern for pandas. let's nuke it. users should never do this.
The text was updated successfully, but these errors were encountered: