0

2 numpy arrays have the exact same values.

arr1 = np.array([1,2,3,4,5])

arr2 = np.array([2,3,1,5,4])

How can I order the values in the first array the way they are ordered in the second array?

Rauan Saturin
  • 61
  • 1
  • 1
  • 7

1 Answers1

0

Try using the np.vectorize method from here

map_dict = {x[0]:x[1] for x in zip(arr1, arr2)}

mapped_array = np.vectorize(map_dict.get)(arr1)
Jamie T
  • 56
  • 1
  • 6