pyarrow.compute.sort_indices#

pyarrow.compute.sort_indices(input,/,sort_keys=(),*,null_placement='at_end',options=None,memory_pool=None)#

Return the indices that would sort an array, record batch or table.

This function computes an array of indices that define a stable sortof the input array, record batch or table. By default, null values areconsidered greater than any other value and are therefore sorted at theend of the input. For floating-point types, NaNs are considered greaterthan any other non-null value, but smaller than null values.

The handling of nulls and NaNs can be changed in SortOptions.

Parameters:
inputArray-like or scalar-like

Argument to compute function.

sort_keyssequence of (name,order)tuples

Names of field/column keys to sort the input on,along with the order each field/column is sorted in.Accepted values fororder are “ascending”, “descending”.The field name can be a string column name or expression.

null_placementstr, default “at_end”

Where nulls in input should be sorted, only applying tocolumns/fields mentioned insort_keys.Accepted values are “at_start”, “at_end”.

optionspyarrow.compute.SortOptions, optional

Alternative way of passing options.

memory_poolpyarrow.MemoryPool, optional

If not passed, will allocate memory from the default memory pool.