bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / ma / extras / in1d
function
numpy.ma.extras:in1d
source: build-install/usr/lib/python3.14/site-packages/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.
Examples
import numpy as np ar1 = np.ma.array([0, 1, 2, 5, 0]) ar2 = [0, 2] np.ma.in1d(ar1, ar2)✓
masked_array(data=[ True, False, True, False, True],
mask=False,
fill_value=True)
See also
- isin
Version of this function that preserves the shape of ar1.
Aliases
numpy.ma.in1d