MCPcopy Index your code
hub / github.com/numpy/numpy / isin

Function isin

numpy/ma/extras.py:1434–1460  ·  view source on GitHub ↗

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 : Equivalen

(element, test_elements, assume_unique=False, invert=False)

Source from the content-addressed store, hash-verified

1432
1433
1434def isin(element, test_elements, assume_unique=False, invert=False):
1435 """
1436 Calculates `element in test_elements`, broadcasting over
1437 `element` only.
1438
1439 The output is always a masked array of the same shape as `element`.
1440 See `numpy.isin` for more details.
1441
1442 See Also
1443 --------
1444 in1d : Flattened version of this function.
1445 numpy.isin : Equivalent function for ndarrays.
1446
1447 Examples
1448 --------
1449 >>> import numpy as np
1450 >>> element = np.ma.array([1, 2, 3, 4, 5, 6])
1451 >>> test_elements = [0, 2]
1452 >>> np.ma.isin(element, test_elements)
1453 masked_array(data=[False, True, False, False, False, False],
1454 mask=False,
1455 fill_value=True)
1456
1457 """
1458 element = ma.asarray(element)
1459 return in1d(element, test_elements, assume_unique=assume_unique,
1460 invert=invert).reshape(element.shape)
1461
1462
1463def union1d(ar1, ar2):

Callers 1

test_isinMethod · 0.90

Calls 2

in1dFunction · 0.85
reshapeMethod · 0.80

Tested by 1

test_isinMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…