How can I do the "in" operation on a numpy array? (Return True if an element is present in the given numpy array)
For strings, lists and dictionaries, the functionality is intuitive to understand.
Here's what I got when I applied that on a numpy array
a
array([[[2, 3, 0],
[1, 0, 1]],
[[3, 2, 0],
[0, 1, 1]],
[[2, 2, 0],
[1, 1, 1]],
[[1, 3, 0],
[2, 0, 1]],
[[3, 1, 0],
[0, 2, 1]]])
b = [[3, 2, 0],
[0, 1, 1]]
b in a
True
#Aligned with the expectation
c = [[300, 200, 0],
[0, 100, 100]]
c in a
True
#Not quite what I expected
See Question&Answers more detail:os