Skip to content

CLN: MultiIndex.drop_duplicates #48592

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

Merged
merged 2 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3864,10 +3864,6 @@ def set_names(self, names, level=None, inplace: bool = False) -> MultiIndex | No

rename = set_names

@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
def drop_duplicates(self, keep: str | bool = "first") -> MultiIndex:
return super().drop_duplicates(keep=keep)

# ---------------------------------------------------------------
# Arithmetic/Numeric Methods - Disabled

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/multi/test_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def test_multi_drop_duplicates_pos_args_deprecation():
idx = MultiIndex.from_arrays([[1, 2, 3, 1], [1, 2, 3, 1]])
msg = (
"In a future version of pandas all arguments of "
"MultiIndex.drop_duplicates will be keyword-only"
"Index.drop_duplicates will be keyword-only"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay given that our next release is 2.0 which we can remove this test entirely (otherwise the previous error message was a little better)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can adjust the deprecation decorator to always print the current class name

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be a good enhancement/followup. Mind opening an issue about that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #48650

)
with tm.assert_produces_warning(FutureWarning, match=msg):
result = idx.drop_duplicates("last")
Expand Down