Create an empty or n-row null-filled copy of the LazyFrame
Description
Returns a n-row null-filled LazyFrame with an identical schema.
n
can be greater than the current number of rows in the
LazyFrame.
Usage
<LazyFrame>$clear(n = 0)
Arguments
n
|
Number of (null-filled) rows to return in the cleared frame. |
Value
A n-row null-filled LazyFrame with an identical schema
Examples
library("polars")
df = pl$LazyFrame(
a = c(NA, 2, 3, 4),
b = c(0.5, NA, 2.5, 13),
c = c(TRUE, TRUE, FALSE, NA)
)
df$clear()
#> polars LazyFrame
#> $explain(): Show the optimized query plan.
#>
#> Naive plan:
#> DF ["a", "b", "c"]; PROJECT */3 COLUMNS; SELECTION: None
#> polars LazyFrame
#> $explain(): Show the optimized query plan.
#>
#> Naive plan:
#> DF ["a", "b", "c"]; PROJECT */3 COLUMNS; SELECTION: None