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.

warning 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.

Command Type

plugin

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 {any}: Polars Schema in format [{name: str}]. CSV, JSON, and JSONL files.
  • --hive-enabled: Enable hive support. Parquet and Arrow files.
  • --hive-start-idx {number}: Start index of hive partitioning. Parquet and Arrow files.
  • --hive-schema {any}: Hive schema in format [{name: str}]. Parquet and Arrow files.
  • --hive-try-parse-dates: Try to parse dates in hive partitioning. Parquet and Arrow files.
  • --truncate-ragged-lines: Truncate lines that are longer than the schema. CSV file.

Parameters

  • file: File path or cloud url to load values from.

Input/output types:

input output
any polars_dataframe
any polars_lazyframe

Examples

Takes a file name and creates a dataframe

> polars open test.csv

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.