polars.LazyFrame.take_every#

LazyFrame.take_every(n: int) polars.internals.lazy_frame.LDF#

Take every nth row in the LazyFrame and return as a new LazyFrame.

Examples

>>> s = pl.DataFrame({"a": [1, 2, 3, 4], "b": [5, 6, 7, 8]}).lazy()
>>> s.take_every(2).collect()
shape: (2, 2)
┌─────┬─────┐
│ a   ┆ b   │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞═════╪═════╡
│ 1   ┆ 5   │
├╌╌╌╌╌┼╌╌╌╌╌┤
│ 3   ┆ 7   │
└─────┴─────┘