nushell/docs/commands/flatten.md
Joseph T. Lyons 4f367a59de
Strip trailing whitespace in files (#4575)
* Strip trailing whitespace in rs files

* Strip trailing whitespace in toml files

* Strip trailing whitespace in md files

* Strip trailing whitespace in nu files
2022-02-21 08:38:15 -05:00

767 B

title layout version
flatten command 0.59.0

Flatten the table.

Signature

> flatten ...rest

Parameters

  • ...rest: optionally flatten data by column

Examples

flatten a table

> [[N, u, s, h, e, l, l]] | flatten

flatten a table, get the first item

> [[N, u, s, h, e, l, l]] | flatten | first

flatten a column having a nested table

> [[origin, people]; [Ecuador, ([[name, meal]; ['Andres', 'arepa']])]] | flatten | get meal

restrict the flattening by passing column names

> [[origin, crate, versions]; [World, ([[name]; ['nu-cli']]), ['0.21', '0.22']]] | flatten versions | last | get versions

Flatten inner table

> { a: b, d: [ 1 2 3 4 ],  e: [ 4 3  ] } | flatten