Reoder the columns of each row of a numpy array based on another numpy array
问题 We have a main array called main_arr , and we want to transform it into another array called result with the same size, using a guide_arr , again with the same size: import numpy as np main_arr = np.array([[3, 7, 4], [2, 5, 6]]) guide_arr = np.array([[2, 0, 1], [0, 2, 1]]) result = np.zeros(main_arr.shape) we need the result to equal to: if np.array_equal(result, np.array([[7, 4, 3], [2, 6, 5]])): print('success!') How should we use guide_arr ? guide_arr[0,0] is 2, meaning that result[0,2] =