DEPR: Remove unnecessary kwargs in groupby ops
State: closed

- [x] closes #50407
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Groupby
name: Deprecate
description: Functionality to remove in pandas
name: Stale

Comments:
> We should add an entry in the whatsnew notes for this change.

Will do
> Thanks for the PR! We should only be deprecating at this point. The arguments can only be removed after a deprecation period. The removal won't happen until we begin working on pandas 3.0.


Thanks I will do the changes
> Thanks for the PR! We should only be deprecating at this point. The arguments can only be removed after a deprecation period. The removal won't happen until we begin working on pandas 3.0.


I looked over the net but could not find out how to deprecate this, can you please explain. I thought that we gad to remove the arguments when I opened the PR.
The idea is that in the next version we start showing warnings to the users in the next version, to let them know if they are passing the arguments that they will be removed, and some versions later we will actually remove them, once they had the time to update their code.

I'd personally still fix this PR with the removals first. The parameters are not veing used, but I wonder if there was any reason we are misssing to add them in the first place. So, it'll be good to see that nothing in our test suite breaks when removing them, before we apply the deprecation warnings.

For the warnings, check at closed PRs with the Deprecate label, and find one about arguments. We have a decorator to do it, but I'm in my phone and I fon't remember the exact name, something like `deprecate_arg` probably.
> 

thanks i'll look for closed pr with `deprecate_arg`
@datapythonista - these arguments are to support passing groupby objects to NumPy; #47836 and #48277
> @datapythonista - these arguments are to support passing groupby objects to NumPy; #47836 and #48277

so should we add this `maybe_warn_args_and_kwargs` in all the methods, as the deprecation message.
Thanks @rhshadrach for the info, I wasn't aware of that, good to know.

@ramvikrams `deprecate_nonkeyword_arguments` is the decorator we need I think.
> Thanks @rhshadrach for the info, I wasn't aware of that, good to know.
> 
> @ramvikrams `deprecate_nonkeyword_arguments` is the decorator we need I think.

Yeah I'll push a commit in 30 mins
I think it's done 
This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.
@ramvikrams do you want to keep working on this PR?
> @ramvikrams do you want to keep working on this PR?

i think it's better I close it