-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DEPR: Remove unnecessary kwargs in groupby ops #50483
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
Changes from all 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 |
---|---|---|
|
@@ -1594,3 +1594,19 @@ def test_multiindex_group_all_columns_when_empty(groupby_func): | |
result = method(*args).index | ||
expected = df.index | ||
tm.assert_index_equal(result, expected) | ||
|
||
|
||
def test_deprecated_keywords(): | ||
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): | ||
df = DataFrame({"a": [1, 1, 2], "b": [3, 4, 5]}) | ||
gb = df.groupby("a") | ||
assert gb.cummax(kwargs=1) | ||
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 think using |
||
assert gb.cummin(kwargs=1) | ||
assert gb.cumsum(args=1, kwargs=1) | ||
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 think you've got this wrong. This is not testing I'd recommend that you make sure you understand well what the |
||
assert gb.cumprod(args=1, kwargs=1) | ||
assert gb.skew(kwargs=1) | ||
assert gb.take(kwargs=1) | ||
Comment on lines
+1607
to
+1612
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.
Also, what will happen with this test if 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'll try this way |
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.