polars.Series.take

Series.take(indices: Union[numpy.ndarray, List[int], polars.internals.expr.Expr]) polars.internals.series.Series

Take values by index.

Parameters
indices

Index location used for selection.

Examples

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