pyarrow.compute.select_k_unstable

pyarrow.compute.select_k_unstable(input, *, memory_pool=None, options=None, k, sort_keys)

Selects the indices of the first k ordered elements from the input.

This function selects an array of indices of the first k ordered elements from the input array, record batch or table specified in the column keys (options.sort_keys). Output is not guaranteed to be stable. The columns that are not specified are returned as well, but not used for ordering. Null values are considered greater than any other value and are therefore sorted at the end of the array. For floating-point types, ordering of values is such that: Null > NaN > Inf > number.

Parameters
  • input (Array-like or scalar-like) – Argument to compute function

  • memory_pool (pyarrow.MemoryPool, optional) – If not passed, will allocate memory from the default memory pool.

  • options (pyarrow.compute.SelectKOptions, optional) – Parameters altering compute function semantics.

  • k (optional) – Parameter for SelectKOptions constructor. Either options or k can be passed, but not both at the same time.

  • sort_keys (optional) – Parameter for SelectKOptions constructor. Either options or sort_keys can be passed, but not both at the same time.