def mask_missing(arr, values_to_mask):
 if (not isinstance(values_to_mask, (list, np.ndarray))):
  values_to_mask = [values_to_mask]
 try:
  values_to_mask = np.array(values_to_mask, dtype=arr.dtype)
 except Exception:
  values_to_mask = np.array(values_to_mask, dtype=object)
 na_mask = isnull(values_to_mask)
 nonna = values_to_mask[(~ na_mask)]
 mask = None
 for x in nonna:
  if (mask is None):
   if is_numeric_v_string_like(arr, x):
    mask = False
   else:
    mask = (arr == x)
   if is_scalar(mask):
    mask = np.zeros(arr.shape, dtype=bool)
  elif is_numeric_v_string_like(arr, x):
   mask |= False
  else:
   mask |= (arr == x)
 if na_mask.any():
  if (mask is None):
   mask = isnull(arr)
  else:
   mask |= isnull(arr)
 return mask

def mask_missing ( arr , values_to_mask ) : if ( not isinstance ( values_to_mask , ( list , np . ndarray ) ) ) : values_to_mask = [ values_to_mask ] try : values_to_mask = np . array ( values_to_mask , dtype = arr . dtype ) except Exception : values_to_mask = np . array ( values_to_mask , dtype = object ) na_mask = isnull ( values_to_mask ) nonna = values_to_mask [ ( ~ na_mask ) ] mask = None for x in nonna : if ( mask is None ) : if is_numeric_v_string_like ( arr , x ) : mask = False else : mask = ( arr == x ) if is_scalar ( mask ) : mask = np . zeros ( arr . shape , dtype = bool ) elif is_numeric_v_string_like ( arr , x ) : mask |= False else : mask |= ( arr == x ) if na_mask . any ( ) : if ( mask is None ) : mask = isnull ( arr ) else : mask |= isnull ( arr ) return mask
return a masking array of same size/shape as arr with entries equaling any member of values_to_mask set to true .