dfr explode for lazyframe

Explodes a dataframe or creates a explode expression.

Signature

> dfr explode ...rest

Parameters

  • ...rest: columns to explode, only applicable for dataframes

Input/output types:

inputoutput
anyany

Examples

Explode the specified dataframe

> [[id name hobbies]; [1 Mercy [Cycling Knitting]] [2 Bob [Skiing Football]]] | dfr into-df | dfr explode hobbies | dfr collect
╭───┬────┬───────┬──────────╮
│ # │ id │ name  │ hobbies  │
├───┼────┼───────┼──────────┤
│ 01 │ Mercy │ Cycling  │
│ 11 │ Mercy │ Knitting │
│ 22 │ Bob   │ Skiing   │
│ 32 │ Bob   │ Football │
╰───┴────┴───────┴──────────╯

Select a column and explode the values

> [[id name hobbies]; [1 Mercy [Cycling Knitting]] [2 Bob [Skiing Football]]] | dfr into-df | dfr select (dfr col hobbies | dfr explode)
╭───┬──────────╮
│ # │ hobbies  │
├───┼──────────┤
│ 0 │ Cycling  │
│ 1 │ Knitting │
│ 2 │ Skiing   │
│ 3 │ Football │
╰───┴──────────╯

Tips: Dataframe commands were not shipped in the official binaries by default, you have to build it with --features=dataframe flag