[docs]defargsort(x:Array,/,*,axis:int=-1,descending:bool=False,stable:bool=True)->Array:""" Return the indices that sort an array along a specified axis. Parameters ---------- x : Array The array to sort axis : int, optional The axis along which to sort. descending : bool, optional Whether to sort in descending order. stable : bool, optional Whether to use a stable sorting algorithm. Note: arkouda's sorting algorithm is always stable so this argument is ignored. """ifaxis==-1:axis=x.ndim-1a=Array._new(ak.argsort(x._array,axis=axis))# TODO: pass a 'flip' argument to the server to avoid this extra stepifdescending:flip(a,axis=axis)returna
[docs]defsort(x:Array,/,*,axis:int=-1,descending:bool=False,stable:bool=True)->Array:""" Return a sorted copy of an array along a specified axis. Parameters ---------- x : Array The array to sort axis : int, optional The axis along which to sort. descending : bool, optional Whether to sort in descending order. stable : bool, optional Whether to use a stable sorting algorithm. Note: arkouda's sorting algorithm is always stable so this argument is ignored. """ifaxis==-1:axis=x.ndim-1ifx.dtypenotin_real_numeric_dtypes:raiseTypeError("Only real numeric dtypes are allowed in sort")a=Array._new(ak.sort(x._array,axis=axis))# TODO: pass a 'flip' argument to the server to avoid this extra stepifdescending:flip(a,axis=axis)returna