pyarrow.compute.partition_nth_indices(array, *, memory_pool=None, options=None, pivot)

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.

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.

  • 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

  • **kwargs (optional) – Parameters for PartitionNthOptions constructor. Either options or **kwargs can be passed, but not both at the same time.