pyarrow.compute.partition_nth_indices¶
- pyarrow.compute.partition_nth_indices(array, /, pivot, *, null_placement='at_end', options=None, memory_pool=None)¶
Return the indices that would partition an array around a pivot.
This functions computes an array of indices that define a non-stable partial sort of the input array.
The output is such that the N’th index points to the N’th element of the input in sorted order, and all indices before the N’th point to elements in the input less or equal to elements at or after the N’th.
By default, null values are considered greater than any other value and are therefore partitioned towards the end of the array. For floating-point types, NaNs are considered greater than any other non-null value, but smaller than null values.
The pivot index N must be given in PartitionNthOptions. The handling of nulls and NaNs can also be changed in PartitionNthOptions.
- Parameters:
- arrayArray-like
Argument to compute function.
- pivot
int
Index into the equivalent sorted array of the pivot element.
- null_placement
str
, default “at_end” Where nulls in the input should be partitioned. Accepted values are “at_start”, “at_end”.
- options
pyarrow.compute.PartitionNthOptions
, optional Alternative way of passing options.
- memory_pool
pyarrow.MemoryPool
, optional If not passed, will allocate memory from the default memory pool.