dfr flatten
for lazyframe> dfr flatten {flags} ...rest
...rest
: columns to flatten, only applicable for dataframesinput | output |
---|---|
any | any |
Flatten the specified dataframe
> [[idnamehobbies]; [1Mercy [CyclingKnitting]] [2Bob [SkiingFootball]]] |dfr into-df|dfr flattenhobbies|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
> [[idnamehobbies]; [1Mercy [CyclingKnitting]] [2Bob [SkiingFootball]]] |dfr into-df|dfr select (dfr colhobbies|dfr flatten)
╭───┬──────────╮
│# │ 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
Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/dfr_flatten.html