polars.Series.gather_every#

Series.gather_every(n: int) Series[source]#

Take every nth value in the Series and return as new Series.

Parameters:
n

Gather every n-th row.

Examples

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