Skip to content

PERF: Only clear cached .levels when setting MultiIndex.names #59578

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 3, 2024

Conversation

mroeschke
Copy link
Member

@mroeschke mroeschke commented Aug 21, 2024

When setting MutilIndex.names, all cached operations were invalidated. These names are only really tied to self.levels (which is also cached), but all usages of self.levels only requires the level values and not names, so we shouldn't need to invalidate operations which accessed the old self.levels values only.

Also removes a validate keyword in _set_names which was never set to False

@mroeschke mroeschke added Performance Memory or execution speed performance MultiIndex labels Aug 21, 2024
@mroeschke mroeschke added this to the 3.0 milestone Aug 21, 2024
@mroeschke
Copy link
Member Author

Going to merge since the tests are passing, but happy to follow up if needed

@mroeschke mroeschke merged commit 2244402 into pandas-dev:main Sep 3, 2024
47 checks passed
@mroeschke mroeschke deleted the perf/multiindex/names branch September 3, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MultiIndex Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant