Skip to content
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

Merged
merged 3 commits into from Oct 1, 2020

Conversation

topper-123
Copy link
Contributor

Deprecates params levels & codes in MultiIndex.copy.

@jbrockmendel
Copy link
Member

looks fine. is there an issue discussing this?

@@ -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)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@jreback jreback added Deprecate Functionality to remove in pandas MultiIndex labels Sep 27, 2020
@topper-123
Copy link
Contributor Author

No issue, so I’m fine discussing it here. My opinion is that copy does too much and removing this makes the API cleaner.

@jreback jreback merged commit 0f9289d into pandas-dev:master Oct 1, 2020
@jreback
Copy link
Contributor

jreback commented Oct 1, 2020

thanks @topper-123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas MultiIndex
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants