File tree 2 files changed +8
-7
lines changed
2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -80,8 +80,9 @@ class PandasObject(DirNamesMixin):
80
80
Baseclass for various pandas objects.
81
81
"""
82
82
83
- # results from calls to methods decorated with cache_readonly get added to _cache
84
- _cache : Dict [str , Any ]
83
+ # results from calls to methods decorated with
84
+ # cache_readonly get added to _cache_property
85
+ _cache_property : Dict [str , Any ]
85
86
86
87
@property
87
88
def _constructor (self ):
@@ -101,12 +102,12 @@ def _reset_cache(self, key: Optional[str] = None) -> None:
101
102
"""
102
103
Reset cached properties. If ``key`` is passed, only clears that key.
103
104
"""
104
- if not hasattr (self , "_cache " ):
105
+ if not hasattr (self , "_cache_property " ):
105
106
return
106
107
if key is None :
107
- self ._cache .clear ()
108
+ self ._cache_property .clear ()
108
109
else :
109
- self ._cache .pop (key , None )
110
+ self ._cache_property .pop (key , None )
110
111
111
112
def __sizeof__ (self ) -> int :
112
113
"""
Original file line number Diff line number Diff line change @@ -103,10 +103,10 @@ def test_hasnans_uncached_for_series():
103
103
# GH#19700
104
104
idx = Index ([0 , 1 ])
105
105
assert idx .hasnans is False
106
- assert "hasnans" in idx ._cache
106
+ assert "hasnans" in idx ._cache_property
107
107
ser = idx .to_series ()
108
108
assert ser .hasnans is False
109
- assert not hasattr (ser , "_cache " )
109
+ assert not hasattr (ser , "_cache_property " )
110
110
ser .iloc [- 1 ] = np .nan
111
111
assert ser .hasnans is True
112
112
assert Series .hasnans .__doc__ == Index .hasnans .__doc__
You can’t perform that action at this time.
0 commit comments