File tree 2 files changed +7
-14
lines changed
2 files changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -702,10 +702,8 @@ def pop(self: FrameOrSeries, item) -> FrameOrSeries:
702
702
"""
703
703
result = self [item ]
704
704
del self [item ]
705
- try :
705
+ if self . ndim == 2 :
706
706
result ._reset_cacher ()
707
- except AttributeError :
708
- pass
709
707
710
708
return result
711
709
@@ -3256,14 +3254,9 @@ def _maybe_update_cacher(
3256
3254
if ref is None :
3257
3255
del self ._cacher
3258
3256
else :
3259
- # Note: we need to call ref._maybe_cache_changed even in the
3260
- # case where it will raise. (Uh, not clear why)
3261
- try :
3257
+ if len (self ) == len (ref ):
3258
+ # otherwise, either self or ref has swapped in new arrays
3262
3259
ref ._maybe_cache_changed (cacher [0 ], self )
3263
- except AssertionError :
3264
- # ref._mgr.setitem can raise
3265
- # AssertionError because of shape mismatch
3266
- pass
3267
3260
3268
3261
if verify_is_copy :
3269
3262
self ._check_setitem_copy (stacklevel = 5 , t = "referant" )
Original file line number Diff line number Diff line change 51
51
from pandas .core .dtypes .dtypes import ExtensionDtype
52
52
from pandas .core .dtypes .generic import (
53
53
ABCDataFrame ,
54
- ABCExtensionArray ,
55
54
ABCIndexClass ,
56
55
ABCPandasArray ,
57
56
ABCSeries ,
@@ -2765,9 +2764,10 @@ def _safe_reshape(arr, new_shape):
2765
2764
"""
2766
2765
if isinstance (arr , ABCSeries ):
2767
2766
arr = arr ._values
2768
- if not isinstance (arr , ABCExtensionArray ):
2769
- # TODO(EA2D): special case not needed with 2D EAs
2770
- arr = arr .reshape (new_shape )
2767
+ if not is_extension_array_dtype (arr .dtype ):
2768
+ # Note: this will include TimedeltaArray and tz-naive DatetimeArray
2769
+ # TODO(EA2D): special case will be unnecessary with 2D EAs
2770
+ arr = np .asarray (arr ).reshape (new_shape )
2771
2771
return arr
2772
2772
2773
2773
You can’t perform that action at this time.
0 commit comments