polars.Series.bottom_k#

Series.bottom_k(k: int = 5) Series[source]#

Return the k smallest elements.

This has time complexity:

\[O(n + k \log{n})\]
Parameters:
k

Number of elements to return.

See also

top_k

Examples

>>> s = pl.Series("a", [2, 5, 1, 4, 3])
>>> s.bottom_k(3)
shape: (3,)
Series: 'a' [i64]
[
    1
    2
    3
]