Write the DataFrame disk in avro format.
File path to which the file should be written, or writable.
Optional
options: WriteAvroOptionsOptions for writing Avro files
Optional
compression?: "uncompressed" | "snappy" | "deflate"Optional
options: WriteAvroOptionsWrite DataFrame to comma-separated values file (csv).
If no options are specified, it will return a new string containing the contents
file or stream to write to
Optional
options: CsvWriterOptionsOptions for
Optional
batchSize?: numberOptional
dateFormat?: stringOptional
datetimeFormat?: stringOptional
floatPrecision?: numberOptional
includeBom?: booleanOptional
includeHeader?: booleanOptional
lineTerminator?: stringOptional
maintainOrder?: booleanOptional
nullValue?: stringOptional
quoteChar?: stringOptional
separator?: stringOptional
timeFormat?: string> const df = pl.DataFrame({
... "foo": [1, 2, 3],
... "bar": [6, 7, 8],
... "ham": ['a', 'b', 'c']
... });
> df.writeCSV();
foo,bar,ham
1,6,a
2,7,b
3,8,c
// using a file path
> df.head(1).writeCSV("./foo.csv")
// foo.csv
foo,bar,ham
1,6,a
// using a write stream
> const writeStream = new Stream.Writable({
... write(chunk, encoding, callback) {
... console.log("writeStream: %O', chunk.toString());
... callback(null);
... }
... });
> df.head(1).writeCSV(writeStream, {includeHeader: false});
writeStream: '1,6,a'
Write to Arrow IPC feather file, either to a file path or to a write stream.
File path to which the file should be written, or writable.
Optional
options: WriteIPCOptionsOptions for DataFrame.writeIPC
Optional
compression?: "uncompressed" | "lz4" | "zstd"Optional
options: WriteIPCOptionsWrite to Arrow IPC stream file, either to a file path or to a write stream.
File path to which the file should be written, or writable.
Optional
options: WriteIPCOptionsOptions for DataFrame.writeIPC
Optional
compression?: "uncompressed" | "lz4" | "zstd"Optional
options: WriteIPCOptionsWrite Dataframe to JSON string, file, or write stream
file or write stream
Optional
options: { format: "lines" | "json" }json | lines
> const df = pl.DataFrame({
... foo: [1,2,3],
... bar: ['a','b','c']
... })
> df.writeJSON({format:"json"})
`[ {"foo":1.0,"bar":"a"}, {"foo":2.0,"bar":"b"}, {"foo":3.0,"bar":"c"}]`
> df.writeJSON({format:"lines"})
`{"foo":1.0,"bar":"a"}
{"foo":2.0,"bar":"b"}
{"foo":3.0,"bar":"c"}`
// writing to a file
> df.writeJSON("/path/to/file.json", {format:'lines'})
Optional
options: { format: "lines" | "json" }Write the DataFrame disk in parquet format.
File path to which the file should be written, or writable.
Optional
options: WriteParquetOptionsOptions for DataFrame.writeParquet
Optional
compression?: "uncompressed" | "snappy" | "gzip" | "lzo" | "brotli" | "lz4" | "zstd"Optional
options: WriteParquetOptions
Write methods for DataFrame