-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
DEPR: deprecate using some params as positional in (DataFrame|Series).apply #53592
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
DEPR: deprecate using some params as positional in (DataFrame|Series).apply #53592
Conversation
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
pandas/tests/apply/test_str.py Outdated
| request.node.add_marker( | ||
| pytest.mark.xfail( | ||
| raises=TypeError, | ||
| raises=TypeError if how == "agg" else FutureWarning, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this only fails because we configure pytest to raise internal pandas warnings as errors. Could you find a way to test the warning instead (or refactor the test entirely since it's tested above)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a new version.
| Why are you deprecating them? Do you intend to change anything that wouldn’t be possible otherwise? |
Concretely I did it because So this is a proposal to make the signatures more similar across these methods, by being able to add an EDIT: So this is mostly motivated by the second positional param in |
I don't think this is a good reason to deprecate other arguments. I think we should be deprecating the other arguments only if they are deemed "not worth the maintenance burden". It's not clear to me if that's the case here. Otherwise we should find other solutions. Would making the signature |
| Personally I also object to the positional deprecation, this probably impact a lot of users while not offering any benefit on our side (maintenance wise) and I am also not convinced that this brings a big enough improvement for users to make it worthwhile. |
I must have written my intention out badly, i.e. I did not intend to propose deprecate the arguments, just them being positional. So my intention is to keep the arguments, but make them keyword-only in v3.0. Is there opposition to do that (I can check if there’s some bad phrasings in the PR if we agree on that goal)? |
| I’ve updated the title & OP to better reflect my intentions. |
| Yes, I object to this. The benefits don't outweigh the downside for me (as written above). I'd feel differently if there was a maintenance benefit, but looks like this is purely cosmetic |
Ah - no, the issue was my reading comprehension! |
| This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
| Seems like this proposal would need more discussion in an issue before proceeding so closing for now. Can reopen if we decided to move forward with this approach |
Deprecate allowing using
raw,result_typeetc. as positional parameters inDataFrame.apply&Series.apply, i.e. requiring them to be keyword-only in the future.EDIT: updated for intent.