Reputation: 1056
Given an array arr
defined as follows
arr = np.arange(4).reshape((2,2))
I want to check if a pair of value [0,1] for exemple is inside my array
I tried np.isin() but it consider the pair of value as two individual value. anyone knows a way to fix this?
Upvotes: 3
Views: 4323
Reputation: 1317
not sure what previously written was what OP wanted
try this
([0,1] == arr).all(axis = 1).any()
Upvotes: 3
Reputation: 4210
You can simply run
print([0,1] in arr)
to see if [0,1]
exists in the first level loop. It should return True
in the example you have provided
Upvotes: 2