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).
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.
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 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]] | dfr into-df | dfr save test.csv
Saves dataframe to CSV file using other delimiter
> [[a b]; [1 2] [3 4]] | dfr into-df | dfr save test.csv --delimiter '|'