polars.Series.gather_every
-
Take every nth value in the Series and return as new Series.
- Parameters:
-
- n
-
Gather every n-th row.
- offset
-
Start the row index at this offset.
Examples
>>> s = pl.Series("a", [1, 2, 3, 4]) >>> s.gather_every(2) shape: (2,) Series: 'a' [i64] [ 1 3 ] >>> s.gather_every(2, offset=1) shape: (2,) Series: 'a' [i64] [ 2 4 ]
Series.gather_every(
n: int,
offset: int = 0,
) → Series
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/series/api/polars.Series.gather_every.html