dfr flatten for lazyframe

An alias for dfr explode.

WARNING

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

Signature

> dfr flatten {flags} ...rest

Parameters

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

Input/output types:

inputoutput
anyany

Examples

Flatten the specified dataframe

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

Select a column and flatten the values

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