Explode the frame to long format by exploding the given columns
Description
Explode the frame to long format by exploding the given columns
Usage
<LazyFrame>$explode(...)
Arguments
…
|
\<dynamic-dots \> Column names, expressions, or a selector
defining them. The underlying columns being exploded must be of the
List or Array data type.
|
Value
A polars LazyFrame
Examples
library("polars")
lf <- pl$LazyFrame(
letters = c("a", "a", "b", "c"),
numbers = list(1, c(2, 3), c(4, 5), c(6, 7, 8))
)
lf$explode("numbers")$collect()
#> shape: (8, 2)
#> ┌─────────┬─────────┐
#> │ letters ┆ numbers │
#> │ --- ┆ --- │
#> │ str ┆ f64 │
#> ╞═════════╪═════════╡
#> │ a ┆ 1.0 │
#> │ a ┆ 2.0 │
#> │ a ┆ 3.0 │
#> │ b ┆ 4.0 │
#> │ b ┆ 5.0 │
#> │ c ┆ 6.0 │
#> │ c ┆ 7.0 │
#> │ c ┆ 8.0 │
#> └─────────┴─────────┘