polars save

For lazyframe.

Saves a dataframe to disk. For lazy dataframes a sink operation will be used if the file type supports it (parquet, ipc/arrow, csv, and ndjson).

warning This command requires a plugin The polars save 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 save {flags} (path)

Flags

  • --type, -t {string}: File type: csv, json, parquet, arrow/ipc. If omitted, derive from file extension.
  • --avro-compression {string}: Compression for avro supports deflate or snappy.
  • --csv-delimiter {string}: File delimiter character.
  • --csv-no-header: Indicates to exclude a header row for CSV files.

Parameters

  • path: Path or cloud url to write to.

Input/output types:

input output
any string

Examples

Performs a streaming collect and save the output to the specified file

> [[a b];[1 2] [3 4]] | polars into-lazy | polars save test.parquet

Saves dataframe to parquet file

> [[a b]; [1 2] [3 4]] | polars into-df | polars save test.parquet

Saves dataframe to arrow file

> [[a b]; [1 2] [3 4]] | polars into-df | polars save test.arrow

Saves dataframe to NDJSON file

> [[a b]; [1 2] [3 4]] | polars into-df | polars save test.ndjson

Saves dataframe to avro file

> [[a b]; [1 2] [3 4]] | polars into-df | polars save test.avro

Saves dataframe to CSV file

> [[a b]; [1 2] [3 4]] | polars into-df | polars save test.csv

Saves dataframe to CSV file using other delimiter

> [[a b]; [1 2] [3 4]] | polars into-df | polars save test.csv --csv-delimiter '|'

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