With two arrays:
X = np.array([[1,2,3], [2,3,1]])
X
array([[1, 2, 3],
[2, 3, 1]])
Y = np.array([['A','B', 'C'], ['A','B', 'C']])
Y
array([['A', 'B', 'C'],
['A', 'B', 'C']],
dtype='|S1')
I am trying to sort Y based on the values of X row by row without looping through each row, i.e
xord = X.argsort()
for i in range(X.shape[0]):
print Y[i][xord[i]]
['A' 'B' 'C']
['C' 'A' 'B']
Is there a more efficient way to sort array Y based on the corresponding row order of X?