polars.Expr.take_every#

Expr.take_every(n: int) Expr[source]#

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

Examples

>>> df = pl.DataFrame({"foo": [1, 2, 3, 4, 5, 6, 7, 8, 9]})
>>> df.select(pl.col("foo").take_every(3))
shape: (3, 1)
┌─────┐
│ foo │
│ --- │
│ i64 │
╞═════╡
│ 1   │
├╌╌╌╌╌┤
│ 4   │
├╌╌╌╌╌┤
│ 7   │
└─────┘