File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -125,10 +125,11 @@ def mask_missing(arr: ArrayLike, values_to_mask) -> npt.NDArray[np.bool_]:
125
125
new_mask [arr_mask ] = arr [arr_mask ] == x
126
126
else :
127
127
# GH#47101
128
- # Fix where type ' bool' has no attribute ' to_numpy()' by first
128
+ # Fix where type bool has no attribute to_numpy() by first
129
129
# attempting to broadcast with np.equal for some cases, and then
130
130
# an explicit type check when checking the mask for any straggling
131
- # cases
131
+ # cases. Where a literal comparison would fail np.equal we fall back
132
+ # to the original equality check.
132
133
try :
133
134
new_mask = np .equal (arr , x )
134
135
except TypeError :
@@ -138,7 +139,7 @@ def mask_missing(arr: ArrayLike, values_to_mask) -> npt.NDArray[np.bool_]:
138
139
if not isinstance (new_mask , np .ndarray ):
139
140
# usually BooleanArray
140
141
if isinstance (new_mask , bool ):
141
- new_mask = np .array ([new_mask ])
142
+ new_mask = np .array ([new_mask ], dtype = bool )
142
143
else :
143
144
new_mask = new_mask .to_numpy (dtype = bool , na_value = False )
144
145
mask |= new_mask
You can’t perform that action at this time.
0 commit comments