s2 = """
import numpy as np
a=np.random.randint(0,200,100)
b1=np.random.randint(0,100,50)
a[np.in1d(a, b1)]
    """
print(' first: ', timeit(stmt=s1, number=100000))
print('second : ', timeit(stmt=s2, number=100000))
Return values from array based on indices of common values in two other arrays