If I have a list of tuples, the "in" function tells me exactly whether the tuple is in the list.
>>> a = [(1,2),(3,4)]
>>> (1,2) in a
True
>>> (1,3) in a
False
That's what I want. But when I do the same thing for b = np.array(a)
, both give True
:
>>> b = np.array(a)
>>> (1,2) in b
True
>>> (1,3) in b
True
So it seems as though the in
function for numpy arrays does not check the tuple anymore, but the single values.
- Why is this?
- How can I achive a truth request regarding whether a 2d element is in a numpy array as in the example above?