You are viewing an older version (2.4.3). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / ma / extras / in1d

function

numpy.ma.extras:in1d

source: /numpy/ma/extras.py :1387

Signature

def   in1d ( ar1 ar2 assume_unique = False invert = False )

Summary

Test whether each element of an array is also present in a second array.

Extended Summary

The output is always a masked array.

We recommend using isin instead of in1d for new code.

Examples

import numpy as np
ar1 = np.ma.array([0, 1, 2, 5, 0])
ar2 = [0, 2]
np.ma.in1d(ar1, ar2)

See also

isin

Version of this function that preserves the shape of ar1.

Aliases

  • numpy.ma.in1d