transpose
for filters> transpose {flags} ...rest
--header-row, -r
: treat the first row as column names--ignore-titles, -i
: don't transpose the column names into values--as-record, -d
: transfer to record if the result is a table and contains only one row--keep-last, -l
: on repetition of record fields due to header-row
, keep the last value obtained--keep-all, -a
: on repetition of record fields due to header-row
, keep all the values obtained...rest
: the names to give columns once transposedinput | output |
---|---|
record | table |
table | any |
Transposes the table contents with default column names
> [[c1c2]; [12]] |transpose
╭───┬─────────┬─────────╮
│# │ column0 │ column1 │
├───┼─────────┼─────────┤
│0│c1│1│
│1│c2│2│
╰───┴─────────┴─────────╯
Transposes the table contents with specified column names
> [[c1c2]; [12]] |transposekeyval
╭───┬─────┬─────╮
│# │ key │ val │
├───┼─────┼─────┤
│0│c1│1│
│1│c2│2│
╰───┴─────┴─────╯
Transposes the table without column names and specify a new column name
> [[c1c2]; [12]] |transpose-ival
╭───┬─────╮
│# │ val │
├───┼─────┤
│0│1│
│1│2│
╰───┴─────╯
Transfer back to record with -d flag
> {c1:1, c2:2} |transpose|transpose-i-r-d
╭────┬───╮
│c1│1│
│c2│2│
╰────┴───╯
Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/transpose.html