I want to compare two NumPy
arrays row-wise and return the number of same rows.
If i use the code below:
a=np.array([[1,2],[3,4]])
b=np.
I think that you want something akin to:
np.sum(np.all(np.equal(a, b), axis=1))
which can shorthand to the following if you prefer:
np.sum(np.all(a == b, axis=1))
This will return 1
for:
a = np.array([[1, 2], [3, 4]])
b = np.array([[1, 2], [5, 6]])
but 0
for:
a = np.array([[1, 2], [3, 4]])
b = np.array([[1, 3], [5, 6]])