isin¶
- isin(x1: array | int, x2: array | int, /, *, invert: bool = False) array¶
Tests for each element in
x1whether the element is inx2.- Parameters:
x1 (Union[array, int]) – first input array. Should have an integer data type.
x2 (Union[array, int]) – second input array. Should have an integer data type.
invert (bool) – boolean indicating whether to invert the test criterion. If
True, the function must test whether each element inx1is not inx2. IfFalse, the function must test whether each element inx1is inx2. Default:False.
- Returns:
out (array) – an array containing element-wise test results. The returned array must have a boolean data type. If
x1is an array, the returned array must have the same shape asx1; otherwise, the returned array must be a zero-dimensional array containing the result.
Notes
At least one of
x1orx2must be an array.If an element in
x1is inx2, the corresponding element in the output array must beTrue; otherwise, the corresponding element in the output array must beFalse.Testing whether an element in
x1corresponds to an element inx2must be determined based on value equality (seeequal()).Comparison of arrays without a corresponding promotable data type (see Type Promotion Rules) is unspecified and thus implementation-defined.