You can use np.where
,but note that as ar[:,0]
is a list of first elements if ar
you need to loop over it and check for membership :
>>> ar[np.where([i in another_ar for i in ar[:,0]])]array([[ 1, 2], [ 6, -15]])
You can use np.where
,but note that as ar[:,0]
is a list of first elements if ar
you need to loop over it and check for membership :
>>> ar[np.where([i in another_ar for i in ar[:,0]])]array([[ 1, 2], [ 6, -15]])