polars.Series.gather_every# Series.gather_every(n: int, offset: int = 0) → Series[source]# 取Series中的每第n个值并返回为新的Series。 Parameters: 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 ]