I have a list of arrays, and I am looking the position of a specific array:
import numpy as np
c = [np.array([0, 0]), np.array([-1, 0]), np.array([ 0, -1]), np.array([0, 1]), np.array([1, 0])]
n = np.array([0,-1])
np.where(c==n)
# array([[ True, False],
[False, False],
[ True, True],
[ True, False],
[False, False]])
I guess it's comparing elemnet by element?
How do I return only the position where both x
and y
are True
, without having to do another np.where
to search [True, True]
?