Skip to content

Commit

Permalink
REF: Consistently use _reset_cache for cache clearing (#59617)
Browse files Browse the repository at this point in the history
Standardize cache clearing
  • Loading branch information
mroeschke authored Aug 28, 2024
1 parent 6752935 commit 1e742f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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

0 comments on commit 1e742f1

Please sign in to comment.