File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -3144,14 +3144,15 @@ def _safe_reshape(arr, new_shape):
3144
3144
return arr
3145
3145
3146
3146
3147
- def _putmask_smart (v , mask , n ):
3147
+ def _putmask_smart (v : np . ndarray , mask : np . ndarray , n ) -> np . ndarray :
3148
3148
"""
3149
3149
Return a new ndarray, try to preserve dtype if possible.
3150
3150
3151
3151
Parameters
3152
3152
----------
3153
- v : `values`, updated in-place (array like)
3154
- mask : np.ndarray
3153
+ v : np.ndarray
3154
+ `values`, updated in-place.
3155
+ mask : np.ndarray[bool]
3155
3156
Applies to both sides (array like).
3156
3157
n : `new values` either scalar or an array like aligned with `values`
3157
3158
@@ -3218,9 +3219,6 @@ def _putmask_preserve(nv, n):
3218
3219
# change the dtype if needed
3219
3220
dtype , _ = maybe_promote (n .dtype )
3220
3221
3221
- if is_extension_array_dtype (v .dtype ) and is_object_dtype (dtype ):
3222
- v = v ._internal_get_values (dtype )
3223
- else :
3224
- v = v .astype (dtype )
3222
+ v = v .astype (dtype )
3225
3223
3226
3224
return _putmask_preserve (v , n )
You can’t perform that action at this time.
0 commit comments