File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -9713,11 +9713,13 @@ def _where(
9713
9713
cond = cond .align (self , join = "right" )[0 ]
9714
9714
else :
9715
9715
if not hasattr (cond , "shape" ):
9716
- cond = np .asanyarray (cond )
9716
+ cond = np .asanyarray (cond , dtype = object )
9717
+ if not cond .flags .writeable :
9718
+ cond .setflags (write = True )
9719
+ cond [isna (cond )] = True
9717
9720
if cond .shape != self .shape :
9718
9721
raise ValueError ("Array conditional must be same shape as self" )
9719
9722
cond = self ._constructor (cond , ** self ._construct_axes_dict (), copy = False )
9720
- cond = cond .fillna (True )
9721
9723
9722
9724
# make sure we are boolean
9723
9725
fill_value = bool (inplace )
@@ -10098,7 +10100,7 @@ def mask(
10098
10100
10099
10101
# see gh-21891
10100
10102
if not hasattr (cond , "__invert__" ):
10101
- cond = np .array (cond )
10103
+ cond = np .array (cond , dtype = object )
10102
10104
10103
10105
if isinstance (cond , np .ndarray ):
10104
10106
if all (
You can’t perform that action at this time.
0 commit comments