polars open
for dataframe
Opens CSV, JSON, NDJSON/JSON lines, arrow, avro, or parquet file to create dataframe. A lazy dataframe will be created by default, if supported.
This command requires a plugin
The polars open
command resides in the polars
plugin. To use this command, you must install and register nu_plugin_polars
. See the Plugins chapter in the book for more information.
Signature
> polars open {flags} (file)
Flags
--eager, -
: Open dataframe as an eager dataframe--type, -t {string}
: File type: csv, tsv, json, parquet, arrow, avro. If omitted, derive from file extension--delimiter, -d {string}
: file delimiter character. CSV file--no-header, -
: Indicates if file doesn't have header. CSV file--infer-schema, - {number}
: Number of rows to infer the schema of the file. CSV file--skip-rows, - {number}
: Number of rows to skip from file. CSV file--columns, - {list<string>}
: Columns to be selected from csv file. CSV and Parquet file--schema, -s {record}
: Polars Schema in format [{name: str}]. CSV, JSON, and JSONL files--truncate-ragged-lines, -
: Truncate lines that are longer than the schema. CSV file
Parameters
file
: file path to load values from
Input/output types:
input | output |
---|---|
any | any |
Examples
Takes a file name and creates a dataframe
> polars open test.csv