0

I have two huge 1D np arrays of row sizes greater than 200,000

say a size ~200,000 and b size ~300,000

i want to find the values of a which are present in b.

so far i have done the below method, but it sure is bad since it is taking too long

elements_common = set([i for i in numpy.reshape(b.shape[0],)]).intersection(set([i for i in numpy.reshape(a.shape[0],)]))

there is too much going on.. i am reshaping, creating a list, creating a set and then finding the intersection. leading to huge time complexities.

are there any better ways. appreciate all your help

user1906450
  • 517
  • 1
  • 6
  • 19

0 Answers0