You can use function intersect1d() of Numpy with parameter return_indices=True. This function will return the common elements along with their indices in both lists.
>>> a=[1, 2, 4, 3]>>> b=[3,4,5,6]>>> ab,a_ind,b_ind=np.intersect1d(a,b, return_indices=True)>>> abarray([3, 4])>>> a_indarray([3, 2], dtype=int64)>>> b_indarray([0, 1], dtype=int64)
>>> a=[1, 2, 4, 3]>>> b=[3,4,5,6]
>>> ab,a_ind,b_ind=np.intersect1d(a,b, return_indices=True)>>> abarray([3, 4])>>> a_indarray([3, 2], dtype=int64)>>> b_indarray([0, 1], dtype=int64)