I am trying to sort a numpy array of tuples. somehow, I came accross a solution like the following, which would give me flexibilities to control the indexes and order of each.
m = mm[mm[:,0].argsort()] # First sort doesn't need to be stable.
m = mm[mm[:,1].argsort(kind='mergesort')[::-1][:100000]]
m = mm[mm[:,3].argsort(kind='mergesort')[::-1][:100000]]
m = mm[mm[:,2].argsort(kind='mergesort')[::-1][:100000]]
but I have received an error as like
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
does it means this kind of solution does not apply to tuple but list?
would someone suggest a better way that I could speed up the sorting procedure rather than np.argsort(mm, order=('a','b','c','d'))?
how would order be able to cope like np.argsort(mm, order=('a','b',-'c','d')) where I can have the index 'c' in reverse order?
Thanks you