dfr into-df for dataframe

Converts a list, table or record into a dataframe.

WARNING

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

Signature

> dfr into-df {flags}

Flags

  • --schema, -s {record}: Polars Schema in format [{name: str}]. CSV, JSON, and JSONL files

Input/output types:

inputoutput
anyany

Examples

Takes a dictionary and creates a dataframe

> [[a b];[1 2] [3 4]] | dfr into-df
╭───┬───┬───╮
 # │ a │ b │
├───┼───┼───┤
 0  1  2 
 1  3  4 
╰───┴───┴───╯

Takes a list of tables and creates a dataframe

> [[1 2 a] [3 4 b] [5 6 c]] | dfr into-df
╭───┬───┬───┬───╮
 # │ 0 │ 1 │ 2 │
├───┼───┼───┼───┤
 0  1  2  a 
 1  3  4  b 
 2  5  6  c 
╰───┴───┴───┴───╯

Takes a list and creates a dataframe

> [a b c] | dfr into-df
╭───┬───╮
 # │ 0 │
├───┼───┤
 0  a 
 1  b 
 2  c 
╰───┴───╯

Takes a list of booleans and creates a dataframe

> [true true false] | dfr into-df
╭───┬───────╮
 # │   0   │
├───┼───────┤
 0  true  
 1  true  
 2  false 
╰───┴───────╯

Convert to a dataframe and provide a schema

> {a: 1, b: {a: [1 2 3]}, c: [a b c]}| dfr into-df -s {a: u8, b: {a: list<u64>}, c: list<str>}
╭───┬───┬───────────────────┬───────────╮
 # │ a │         b         │     c     │
├───┼───┼───────────────────┼───────────┤
 0  1  ╭───┬───────────╮  ╭───┬───╮ 
           ╭───┬───╮    0  a  
        a   0  1     1  b  
            1  2     2  c  
            2  3    ╰───┴───╯ 
           ╰───┴───╯             
       ╰───┴───────────╯            
╰───┴───┴───────────────────┴───────────╯