[ Web Proxy ]
URL:
Viewing: https://arrow.apache.org/docs/python/api/../generated/pyarrow.compute.bottom_k_unstable.html [Back]  [Original]

pyarrow.compute.bottom_k_unstable — Apache Arrow v25.0.1
Back to top
Search the docs ...:

pyarrow.compute.bottom_k_unstable#

pyarrow.compute.bottom_k_unstable(values, k, sort_keys=None, null_placements=None, *, memory_pool=None)[source]#

Select the indices of the bottom-k ordered elements from array- or table-like data.

This is a specialization for select_k_unstable(). Output is not guaranteed to be stable.

Parameters:
valuesArray, ChunkedArray, RecordBatch, or Table

Data to sort and get bottom indices from.

kint

The number of k elements to keep.

sort_keysList-like

Column key names to order by when input is table-like data.

null_placementsA list of at_start or at_end

Whether nulls and NaNs are placed at the start or at the end. Accepted values are at_end, at_start.

memory_poolMemoryPool, optional

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

Returns:
resultArray of indices

Indices of the bottom-k ordered elements

Examples

>>> import pyarrow as pa
>>> import pyarrow.compute as pc
>>> arr = pa.array(["a", "b", "c", None, "e", "f"])
>>> pc.bottom_k_unstable(arr, k=3)
<pyarrow.lib.UInt64Array object at ...>
[
  0,
  1,
  2
]

Web Proxy Viewer  |  New URL  |  Original Page