polars.Series.gather_every
-
Выбрать каждое n-е значение в Series и вернуть его в виде новой Series.
- Параметры:
-
- n
-
Выбирать каждую n-ю строку.
- offset
-
Начать отсчёт индекса строки с этого смещения.
Примеры
>>> 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