polars.Series.take#

Series.take(indices: int | list[int] | Expr | Series | numpy.ndarray[Any, Any]) Series[source]#

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
]