-
-
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
DEPR: Remove unnecessary kwargs in groupby ops #50483
Changes from 14 commits
7ebf822
88ab270
aff453d
4f6548b
2a680be
6569006
3a150f6
519d9da
20c8606
b026a74
dfed625
1676d19
b3ca2f2
90fb8dc
fe8f551
e45c8ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,16 @@ | |
from pandas.util._decorators import deprecate_nonkeyword_arguments | ||
|
||
import pandas._testing as tm | ||
from pandas.core.groupby.generic import ( | ||
skew, | ||
take, | ||
) | ||
from pandas.core.groupby.groupby import ( | ||
cummax, | ||
cummin, | ||
cumprod, | ||
cumsum, | ||
) | ||
|
||
|
||
@deprecate_nonkeyword_arguments( | ||
|
@@ -155,3 +165,17 @@ def test_class(): | |
) | ||
with tm.assert_produces_warning(FutureWarning, match=msg): | ||
Foo().baz("qux", "quox") | ||
|
||
|
||
def test_deprecated_keywords(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is for testing the decorator itself, these tests should go in |
||
msg = ( | ||
"In the future version of pandas the arguments args" | ||
"and kwargs will be deprecated for these functions" | ||
) | ||
with tm.assert_produces_warning(FutureWarning, match=msg): | ||
assert cummax | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Instead, this needs to call the function itself, e.g.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh thanks I'll do the changes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i did the changes but still the tests are failing, don't know why |
||
assert cummin | ||
assert cumprod | ||
assert cumsum | ||
assert skew | ||
assert take |
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.
Having another look, looks like
deprecate_nonkeyword_arguments
doesn't deprecate the argument, but makes it usable only via a keyword argument (e.g.foo(1)
would produce the warning, butfoo(val=1)
wouldn't). If that's the case, doesn't seem like we've got a decorator to simply deprecate an argument. In that case, you'll have to produce it manually.