Spec-Zone.ru › Polars

polars.Series.gather_every

Series.gather_every(
    n: int,
    offset: int = 0,
) → Series

Выбрать каждое 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
]

© 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

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API