Suppose I have an array
A
(M, K)
B
(N, K)
B
K
C
(M,)
C[i]
B
i
A
A = np.array([[0, 1], [0, 1], [1, 0]])
B = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
C = np.array([1, 1, 2])
Based on this solution
, here's a vectorized solution using np.searchsorted

dims = B.max(0)+1
A1D = np.ravel_multi_index(A.T,dims)
B1D = np.ravel_multi_index(B.T,dims)
sidx = B1D.argsort()
out = sidx[np.searchsorted(B1D,A1D,sorter=sidx)]
Sample run 
In [43]: A
Out[43]:
array([[72, 89, 75],
[72, 89, 75],
[93, 38, 61],
[47, 67, 50],
[47, 67, 50],
[93, 38, 61],
[72, 89, 75]])
In [44]: B
Out[44]:
array([[47, 67, 50],
[93, 38, 61],
[41, 55, 27],
[72, 89, 75]])
In [45]: out
Out[45]: array([3, 3, 1, 0, 0, 1, 3])