Apr-18-2019, 06:17 AM
I have two numpy-matrices ("A" and "B"). I want to compare every row-vector in "A" matrix with every row-vector in "B" matrix.
Here is my (not working) code. The expected output is 5.
Here is my (not working) code. The expected output is 5.
import numpy as np a=np.matrix([[1,2,3],[42,68,69],[1,2,3],[85,89,95]]) b=np.matrix([[42,68,69],[1,2,3],[85,89,95], [42,68,69]]) found_one=0 for i in range(3): for j in range(3): if a[i,]==b[j,]]: found_one=found_one+1 print(found_one)Any suggestion?