I have two identically-sized numpy ndarrays with permuted rows:
import numpy as np
a = np.ndarray([[1,2,3],
[4,5,6],
[7,8,9],
[10,11,12]])
b = np.ndarray([[7,8,9],
[10,11,12],
[1,2,3],
[4,5,6]])
I want a function that returns the indices of each row in first array, relative to the second array. For example:
compare_row_indices(a,b)
would return
[2,3,0,1] # 0-based indexing
What is the most pythonic way to implement this function?