partition_nth_indices(array, *, memory_pool=None, options=None, pivot, null_placement='at_end')¶
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.
array (Array-like) – Argument to compute function
memory_pool (pyarrow.MemoryPool, optional) – If not passed, will allocate memory from the default memory pool.
options (pyarrow.compute.PartitionNthOptions, optional) – Parameters altering compute function semantics.
pivot (optional) – Parameter for PartitionNthOptions constructor. Either options or pivot can be passed, but not both at the same time.
null_placement (optional) – Parameter for PartitionNthOptions constructor. Either options or null_placement can be passed, but not both at the same time.