-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
DEPR: Deprecate params levels & codes in MultiIndex.copy #36685
Conversation
looks fine. is there an issue discussing this? |
pandas/core/indexes/multi.py
Outdated
@@ -1575,7 +1594,7 @@ def dropna(self, how="any"): | |||
raise ValueError(f"invalid how option: {how}") | |||
|
|||
new_codes = [level_codes[~indexer] for level_codes in self.codes] | |||
return self.copy(codes=new_codes, deep=True) | |||
return self.copy(deep=True).set_codes(codes=new_codes) |
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.
isn't this copying twice?
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.
Looking again, the call to .copy
isn't needed because a MultiIndex
is immutable, so I've removed that call.
No issue, so I’m fine discussing it here. My opinion is that copy does too much and removing this makes the API cleaner. |
9147eed
to
01f2f03
Compare
01f2f03
to
46b20b8
Compare
thanks @topper-123 |
Deprecates params
levels
&codes
inMultiIndex.copy
.