Sorting arrays by column
09 December 2018
With argsort, you get the index of the sorted array, which you can use to access the original array in sorted order. By selecting a single column for the sort algorithmn you can sort the array by the different columns
Assume an array with 3 columns and N rows
arr_org = np.random.rand((20,3))
idx=arr_org[:,3].argsort()
arr_sort =arr_org[idx]