File tree Expand file tree Collapse file tree 2 files changed +7
-14
lines changed Expand file tree Collapse file tree 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:
702702 """
703703 result = self [item ]
704704 del self [item ]
705- try :
705+ if self . ndim == 2 :
706706 result ._reset_cacher ()
707- except AttributeError :
708- pass
709707
710708 return result
711709
@@ -3256,14 +3254,9 @@ def _maybe_update_cacher(
32563254 if ref is None :
32573255 del self ._cacher
32583256 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
32623259 ref ._maybe_cache_changed (cacher [0 ], self )
3263- except AssertionError :
3264- # ref._mgr.setitem can raise
3265- # AssertionError because of shape mismatch
3266- pass
32673260
32683261 if verify_is_copy :
32693262 self ._check_setitem_copy (stacklevel = 5 , t = "referant" )
Original file line number Diff line number Diff line change 5151from pandas .core .dtypes .dtypes import ExtensionDtype
5252from pandas .core .dtypes .generic import (
5353 ABCDataFrame ,
54- ABCExtensionArray ,
5554 ABCIndexClass ,
5655 ABCPandasArray ,
5756 ABCSeries ,
@@ -2765,9 +2764,10 @@ def _safe_reshape(arr, new_shape):
27652764 """
27662765 if isinstance (arr , ABCSeries ):
27672766 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 )
27712771 return arr
27722772
27732773
You can’t perform that action at this time.
0 commit comments