I am trying to do these steps in NumPy. It was easy to do this with python list sort()
, and argsort()
.
How do I do this in Numpy?
a = np.array([10,30,20,40,50])a_sorted = np.array([10,20,30,40,50])
Get mask of a_sorted
b = np.array(['one','three','two','four','five'])
Apply the mask to b
Expected array sorted according to a_sorted:
b_sorted = np.array(['one','two','three','four','five'])