File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -359,20 +359,18 @@ def mask_missing(arr, values_to_mask):
359
359
if mask is None :
360
360
mask = arr == x
361
361
362
- # if x is a string and mask is not, then we get a scalar
363
- # return value, which is not good
364
- if not isinstance (mask , np .ndarray ):
365
- m = mask
366
- mask = np .empty (arr .shape , dtype = np .bool )
367
- mask .fill (m )
362
+ # if x is a string and arr is not, then we get False and we must
363
+ # expand the mask to size arr.shape
364
+ if np .isscalar (mask ):
365
+ mask = np .zeros (arr .shape , dtype = bool )
368
366
else :
369
- mask = mask | ( arr == x )
367
+ mask |= arr == x
370
368
371
369
if na_mask .any ():
372
370
if mask is None :
373
371
mask = isnull (arr )
374
372
else :
375
- mask = mask | isnull (arr )
373
+ mask |= isnull (arr )
376
374
377
375
return mask
378
376
You can’t perform that action at this time.
0 commit comments