[Numpy-discussion] How to get Boolean matrix for similar lists in two different-size numpy arrays of lists

zoj613 blkzol001 at myuct.ac.za
Sun Mar 14 16:17:40 EDT 2021

The following seems to produce what you want using the data provided

In [31]: dF = np.genfromtxt('/home/F.csv', delimiter=',').tolist()

In [32]: dS = np.genfromtxt('/home/S.csv', delimiter=',').tolist()

In [33]: r =  [True if i in lS else False for i in dF]

In [34]: sum(r)

Out[34]: 300

I hope this helps.

Sent from: http://numpy-discussion.10968.n7.nabble.com/

More information about the NumPy-Discussion mailing list