numpy.isin(element, test_elements, assume_unique=False, invert=False)
Parameters:
element : array_like Input array.
test_elements : array_like
The values against which to test each value of element. This argument is flattened if it is an array or array_like. See notes for behavior with non-array-like parameters.
- assume_unique : bool, optional
If True, the input arrays are both assumed to be unique, which can speed up the calculation. Default is False.
- invert : bool, optional
If True, the values in the returned array are inverted, as if calculating element not in test_elements. Default is False. np.isin(a, b, invert=True) is equivalent to (but faster than) np.invert(np.isin(a, b)).
1 | >>> element = 2*np.arange(4).reshape((2, 2)) |