-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Deprecate non-keyword arguments for Index.set_names. #41551
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 1 commit
f6e9ac1
17f5ff0
ec20b8b
a94c8ea
fc525c8
34b4f2f
aa2e644
d38573b
2d39763
1340963
dc528b0
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 |
---|---|---|
|
@@ -345,6 +345,19 @@ def test_set_names_with_nlevel_1(inplace): | |
tm.assert_index_equal(result, expected) | ||
|
||
|
||
def test_multi_set_names_pos_args_deprecation(): | ||
# GH#41485 | ||
idx = MultiIndex.from_product([["python", "cobra"], [2018, 2019]]) | ||
|
||
msg = ( | ||
"Starting with pandas version 2.0 all arguments of Index.set_names " | ||
"except for the argument 'names' will be keyword-only" | ||
) | ||
|
||
with tm.assert_produces_warning(FutureWarning, match=msg): | ||
idx.set_names(["kind", "year"], None) | ||
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. Can you also check the result? Again, I'm aware that I didn't do this in the example PR I opened, but then other reviewers suggested it - there's an example in #41511 . Same for the Series test 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. No problem, added in the latest commit. |
||
|
||
|
||
@pytest.mark.parametrize("ordered", [True, False]) | ||
def test_set_levels_categorical(ordered): | ||
# GH13854 | ||
|
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.
Can you put
version=None
? I know I'd originally putversion="2.0"
, but then other reviewers expressed a preference for not specifying the exact version.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.
Added in my latest commit.
I think these changes also apply to the PR I opened for drop_duplicates (#41500)
Would you like me to make these changes there too?
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.
Yes please, thanks! Your help with these is much appreciated