Finding indexes of matching rows in two numpy arrays -


this question has answer here:

how can find indexes of rows match between 2 numpy arrays. example:

x = np.array(([0,1],               [1,0],               [0,0])) y = np.array(([0,1],               [1,1],               [0,0])) 

this should return:

matches = [0,2] # match @ row no 0 , 2 

np.flatnonzero((x == y).all(1)) # array([0, 2]) 

or:

np.nonzero((x == y).all(1))[0] 

or:

np.where((x == y).all(1))[0] 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -