I have a Numpy array A:
A = np.array([1,2,3,4,5,6,8,10,12,15,20,100,200,300,500])
And another Numpy array B with pairs of numbers:
B = np.array([[2000,1000],[5000,10000],[1,1000],[300,700],[500,5],[500,700],[1,5])
I am looking for the most efficient way to find the index of the first occurrence of the pairs from B that are present in A (if available). Order of numbers within pair doesn't matter. In the example above, the numbers of pair [500,5]
represent the first pair that is found in A.
Is there any elegant Numpy solution, without looping through each pair one by one? Appreciate any hints!