MAINT: changed to np.argsort with kind=mergesort (stable sort)