-
-
Couldn't load subscription status.
- Fork 19.2k
Deprecate non-keyword arguments for drop_duplicates. #41500
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 2 commits
ebd40aa
8cb7645
fa6574c
d7c341a
19aa589
448e8a1
0d54ca7
463c37a
c0d3d34
2cb482f
09fe413
03d0330
be8393d
fbf70a2
937d9e2
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 |
|---|---|---|
|
|
@@ -471,3 +471,14 @@ def test_drop_duplicates_non_boolean_ignore_index(arg): | |
| msg = '^For argument "ignore_index" expected type bool, received type .*.$' | ||
| with pytest.raises(ValueError, match=msg): | ||
| df.drop_duplicates(ignore_index=arg) | ||
|
|
||
|
|
||
| def test_drop_duplicates_pos_args_deprecation(): | ||
| # test deprecation warning message for positional arguments GH#41485 | ||
|
||
| df = DataFrame({"a": [1, 1, 2], "b": [1, 1, 3], "c": [1, 1, 3]}) | ||
| msg = ( | ||
| r"Starting with Pandas version 2\.0 all arguments of drop_duplicates except for " | ||
|
||
| r"the argument 'self' will be keyword-only" | ||
| ) | ||
| with tm.assert_produces_warning(FutureWarning, match=msg): | ||
| df.drop_duplicates(["b", "c"]) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -223,3 +223,14 @@ def test_drop_duplicates_categorical_bool(self, ordered): | |
| return_value = sc.drop_duplicates(keep=False, inplace=True) | ||
| assert return_value is None | ||
| tm.assert_series_equal(sc, tc[~expected]) | ||
|
|
||
|
|
||
| def test_drop_duplicates_pos_args_deprecation(): | ||
| # test deprecation warning message for positional arguments GH#41485 | ||
|
||
| s = Series(['a', 'b', 'c', 'b']) | ||
| msg = ( | ||
| r"Starting with Pandas version 2\.0 all arguments of drop_duplicates except for " | ||
| r"the argument 'self' will be keyword-only" | ||
| ) | ||
| with tm.assert_produces_warning(FutureWarning, match=msg): | ||
| s.drop_duplicates("last") | ||
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.
perhaps mention that
subsetis allowed (e.g. "except forsubset"), other than that, if the tests all pass, this looks good to meThere 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.
Alright, thanks, I made that change and committed again.
I have checked that all tests on the methods (not just mine) still pass without issue also.