import numpy as np
a=np.random.randint(0,200,100)#rand int array
b1=np.random.randint(0,100,50)
b2=b1**3
c=[]
I have a problem I think should be easy but can't find solution, I want to find the matching values in two arrays, then use the indices of one of these to find values in another array
for i in range(len(a)):
for j in range(len(b1)):
if b1[j]==a[i]:
c.append(b2[j])
c=np.asarray(c)
Clearly the above method does work, but it's very slow, and this is just an example, in the work I'm actually do a,b1,b2 are all over 10,000 elements.
Any faster solutions?