rename for filters

Creates a new table with columns renamed.

Signature

> rename ...rest --column

Parameters

  • ...rest: the new names for the columns
  • --column {list<string>}: column name to be changed

Examples

Rename a column

> [[a, b]; [1, 2]] | rename my_column
╭───┬───────────┬───╮
│ # │ my_column │ b │
├───┼───────────┼───┤
│ 012 │
╰───┴───────────┴───╯

Rename many columns

> [[a, b, c]; [1, 2, 3]] | rename eggs ham bacon
╭───┬──────┬─────┬───────╮
│ # │ eggs │ ham │ bacon │
├───┼──────┼─────┼───────┤
│ 0123 │
╰───┴──────┴─────┴───────╯

Rename a specific column

> [[a, b, c]; [1, 2, 3]] | rename -c [a ham]
╭───┬─────┬───┬───╮
│ # │ ham │ b │ c │
├───┼─────┼───┼───┤
│ 0123 │
╰───┴─────┴───┴───╯

Rename the fields of a record

> {a: 1 b: 2} | rename x y
╭───┬───╮
│ x │ 1 │
│ y │ 2 │
╰───┴───╯