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

REF: Consistently use _reset_cache for cache clearing #59617

Merged
merged 2 commits into from
Aug 28, 2024
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: 2 additions & 2 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ def _view(self) -> MultiIndex:
verify_integrity=False,
)
result._cache = self._cache.copy()
result._cache.pop("levels", None) # GH32669
result._reset_cache("levels") # GH32669
return result

# --------------------------------------------------------------------
Expand Down Expand Up @@ -1384,7 +1384,7 @@ def copy( # type: ignore[override]
verify_integrity=False,
)
new_index._cache = self._cache.copy()
new_index._cache.pop("levels", None) # GH32669
new_index._reset_cache("levels") # GH32669
if keep_id:
new_index._id = self._id
return new_index
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/internals/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2154,7 +2154,7 @@ def setitem_inplace(self, indexer, value) -> None:
"""
if not self._has_no_reference(0):
self.blocks = (self._block.copy(),)
self._cache.clear()
self._reset_cache()

arr = self.array

Expand All @@ -2179,7 +2179,7 @@ def idelete(self, indexer) -> SingleBlockManager:
nb = self._block.delete(indexer)[0]
self.blocks = (nb,)
self.axes[0] = self.axes[0].delete(indexer)
self._cache.clear()
self._reset_cache()
return self

def fast_xs(self, loc):
Expand Down