dfr melt for dataframe

Unpivot a DataFrame from wide to long format.

Signature

> dfr melt {flags}

Flags

  • --columns, -c {table}: column names for melting
  • --values, -v {table}: column names used as value columns
  • --variable-name, -r {string}: optional name for variable column
  • --value-name, -l {string}: optional name for value column

Input/output types:

input output
any any

Examples

melt dataframe

> [[a b c d]; [x 1 4 a] [y 2 5 b] [z 3 6 c]] | dfr into-df | dfr melt -c [b c] -v [a d]
╭───┬───┬───┬──────────┬───────╮
 # │ b │ c │ variable │ value │
├───┼───┼───┼──────────┼───────┤
 0  1  4  a         x     
 1  2  5  a         y     
 2  3  6  a         z     
 3  1  4  d         a     
 4  2  5  d         b     
 5  3  6  d         c     
╰───┴───┴───┴──────────┴───────╯

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