polars.LazyFrame.slice
-
Get a slice of this DataFrame.
- Parameters:
-
- offset
-
Start index. Negative indexing is supported.
- length
-
Length of the slice. If set to
None, all rows starting at the offset will be selected.
Examples
>>> lf = pl.LazyFrame( ... { ... "a": ["x", "y", "z"], ... "b": [1, 3, 5], ... "c": [2, 4, 6], ... } ... ) >>> lf.slice(1, 2).collect() shape: (2, 3) ┌─────┬─────┬─────┐ │ a ┆ b ┆ c │ │ --- ┆ --- ┆ --- │ │ str ┆ i64 ┆ i64 │ ╞═════╪═════╪═════╡ │ y ┆ 3 ┆ 4 │ │ z ┆ 5 ┆ 6 │ └─────┴─────┴─────┘
LazyFrame.slice(
offset: int,
length: int | None = None,
) → LazyFrame
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/lazyframe/api/polars.LazyFrame.slice.html