def mask_missing(arr, values_to_mask):
dtype, values_to_mask = infer_dtype_from_array(values_to_mask)<EOL>try:<EOL><INDENT>values_to_mask = np.array(values_to_mask, dtype=dtype)<EOL><DEDENT>except Exception:<EOL><INDENT>values_to_mask = np.array(values_to_mask, dtype=object)<EOL><DEDENT>na_mask = isna(values_to_mask)<EOL>nonna = values_to_mask[~na_mask]<EOL>mask = None<EOL>for x in nonna:<EOL><INDENT>if mask is None:<EOL><INDENT>if is_numeric_v_string_like(arr, x):<EOL><INDENT>mask = False<EOL><DEDENT>else:<EOL><INDENT>mask = arr == x<EOL><DEDENT>if is_scalar(mask):<EOL><INDENT>mask = np.zeros(arr.shape, dtype=bool)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if is_numeric_v_string_like(arr, x):<EOL><INDENT>mask |= False<EOL><DEDENT>else:<EOL><INDENT>mask |= arr == x<EOL><DEDENT><DEDENT><DEDENT>if na_mask.any():<EOL><INDENT>if mask is None:<EOL><INDENT>mask = isna(arr)<EOL><DEDENT>else:<EOL><INDENT>mask |= isna(arr)<EOL><DEDENT><DEDENT>if mask is None:<EOL><INDENT>mask = np.zeros(arr.shape, dtype=bool)<EOL><DEDENT>return mask<EOL>
Return a masking array of same size/shape as arr
with entries equaling any member of values_to_mask set to True