polars.LazyFrame.clear
-
Создаёт пустую копию текущего LazyFrame с количеством строк от нуля до «n».
Возвращает копию с идентичной схемой, но без данных.
- Параметры:
-
- n
-
Количество пустых строк, возвращаемых в очищенном кадре.
См. также
-
clone -
Недорогое глубокое копирование/клонирование.
Примеры
>>> lf = pl.LazyFrame( ... { ... "a": [None, 2, 3, 4], ... "b": [0.5, None, 2.5, 13], ... "c": [True, True, False, None], ... } ... ) >>> lf.clear().collect() shape: (0, 3) ┌─────┬─────┬──────┐ │ a ┆ b ┆ c │ │ --- ┆ --- ┆ --- │ │ i64 ┆ f64 ┆ bool │ ╞═════╪═════╪══════╡ └─────┴─────┴──────┘>>> lf.clear(2).collect() shape: (2, 3) ┌──────┬──────┬──────┐ │ a ┆ b ┆ c │ │ --- ┆ --- ┆ --- │ │ i64 ┆ f64 ┆ bool │ ╞══════╪══════╪══════╡ │ null ┆ null ┆ null │ │ null ┆ null ┆ null │ └──────┴──────┴──────┘
LazyFrame.clear(
n: int = 0,
) → LazyFrame
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/lazyframe/api/polars.LazyFrame.clear.html