Skip to content

Commit 8d5b0ba

Browse files
committed
ENH: Deprecate non-keyword arguments for drop_duplicates.
1 parent 3285e69 commit 8d5b0ba

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6005,7 +6005,7 @@ def dropna(
60056005
else:
60066006
return result
60076007

6008-
@deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self"])
6008+
@deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self", "subset"])
60096009
def drop_duplicates(
60106010
self,
60116011
subset: Hashable | Sequence[Hashable] | None = None,

pandas/tests/frame/methods/test_drop_duplicates.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,11 @@ def test_drop_duplicates_non_boolean_ignore_index(arg):
474474

475475

476476
def test_drop_duplicates_pos_args_deprecation():
477-
# test deprecation warning message for positional arguments GH#41485
477+
# GH#41485
478478
df = DataFrame({"a": [1, 1, 2], "b": [1, 1, 3], "c": [1, 1, 3]})
479479
msg = (
480-
r"Starting with Pandas version 2\.0 all arguments of drop_duplicates except for "
481-
r"the argument 'self' will be keyword-only"
480+
r"Starting with Pandas version 2\.0 all arguments of drop_duplicates "
481+
r"except for the argument 'self' will be keyword-only"
482482
)
483483
with tm.assert_produces_warning(FutureWarning, match=msg):
484484
df.drop_duplicates(["b", "c"])

pandas/tests/series/methods/test_drop_duplicates.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,11 @@ def test_drop_duplicates_categorical_bool(self, ordered):
226226

227227

228228
def test_drop_duplicates_pos_args_deprecation():
229-
# test deprecation warning message for positional arguments GH#41485
230-
s = Series(['a', 'b', 'c', 'b'])
229+
# GH#41485
230+
s = Series(["a", "b", "c", "b"])
231231
msg = (
232-
r"Starting with Pandas version 2\.0 all arguments of drop_duplicates except for "
233-
r"the argument 'self' will be keyword-only"
232+
r"Starting with Pandas version 2\.0 all arguments of drop_duplicates "
233+
r"except for the argument 'self' will be keyword-only"
234234
)
235235
with tm.assert_produces_warning(FutureWarning, match=msg):
236236
s.drop_duplicates("last")

0 commit comments

Comments
 (0)