x = np.array([[1, 2, 3], [1, 2, 3], [4, 5, 6], [7, 8, 9]])
y = np.array([[1, 2, 3], [7, 8, 9]])
xhash = [hashlib.sha1(row).digest() for row in x]
yhash = [hashlib.sha1(row).digest() for row in y]
z = np.in1d(xhash, yhash)
_, unique = np.unique(np.array(xhash)[z], return_index=True)
idx = np.array(list(range(len(xhash))))
unique_idx = np.array(idx)[z][unique]
print(('x=', x))
print(('unique_idx=', unique_idx))
print(('x[unique_idx]=', x[unique_idx]))
Get unique intersection values of two sets