0

I have two array

scores = np.array([[0.3, 0.5, 0.1], [0.2, 0.2, 0.1], [0.1, 0.2, 0.3]])
ids = np.array([[1,2,3],[4,5,6],[7,8,9]])

what I want is to sort two array together in the column dimension with the scores array as the sorting keys.

I tried

sort_idxes = np.argsort(scores)
scores = scores[sort_idxes]
ids = ids[sort_idxes]

which gives two 3x3x3 arrays. What I want is just sorted scores and ids as the following

 scores: [
[0.1, 0.3, 0.5], 
[0.1, 0.2, 0.2],
[0.1, 0.2, 0.3]]

 ids: [
[3, 1, 2], 
[6, 4, 5], 
[7, 8, 9]]
Tony
  • 1,225
  • 3
  • 12
  • 26

0 Answers0