Quantcast
Channel: NumPy: filter rows by np.array - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Mazdak for NumPy: filter rows by np.array

$
0
0

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]])

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>