numpy.ma.isin#

ma.isin(element, test_elements, assume_unique=False, invert=False)[source]#

Calculates element in test_elements, broadcasting over element only.

The output is always a masked array of the same shape as element. See numpy.isin for more details.

See also

in1d

Flattened version of this function.

numpy.isin

Equivalent function for ndarrays.

Notes

New in version 1.13.0.

Examples

>>> element = np.ma.array([1, 2, 3, 4, 5, 6])
>>> test_elements = [0, 2]
>>> np.ma.isin(element, test_elements)
masked_array(data=[False,  True, False, False, False, False],
             mask=False,
       fill_value=True)