LArray.labelsofsorted(self, axis=None, ascending=True, kind='quicksort')[source]

Returns the labels that would sort this array.

Performs an indirect sort along the given axis using the algorithm specified by the kind keyword. It returns an array of labels of the same shape as a that index data along the given axis in sorted order.

axisint or str or Axis, optional

Axis along which to sort. This can be omitted if array has only one axis.

ascendingbool, optional

Sort values in ascending order. Defaults to True.

kind{‘quicksort’, ‘mergesort’, ‘heapsort’}, optional

Sorting algorithm. Defaults to ‘quicksort’.



>>> arr = LArray([[0, 1], [3, 2], [2, 5]], "nat=BE,FR,IT; sex=M,F")
>>> arr
nat\sex  M  F
     BE  0  1
     FR  3  2
     IT  2  5
>>> arr.labelsofsorted('sex')
nat\sex  0  1
     BE  M  F
     FR  F  M
     IT  M  F
>>> arr.labelsofsorted('sex', ascending=False)
nat\sex  0  1
     BE  F  M
     FR  M  F
     IT  F  M