polars.DataFrame.write_ipc_stream
-
Write to Arrow IPC record batch stream.
See “Streaming format” in https://arrow.apache.org/docs/python/ipc.html.
Changed in version 1.1: The
futureparameter was renamedcompat_level.- Parameters:
-
- file
-
Path or writable file-like object to which the IPC record batch data will be written. If set to
None, the output is returned as a BytesIO object. -
compression{‘uncompressed’, ‘lz4’, ‘zstd’} -
Compression method. Defaults to “uncompressed”.
- compat_level
-
Use a specific compatibility level when exporting Polars’ internal data structures.
Examples
>>> import pathlib >>> >>> df = pl.DataFrame( ... { ... "foo": [1, 2, 3, 4, 5], ... "bar": [6, 7, 8, 9, 10], ... "ham": ["a", "b", "c", "d", "e"], ... } ... ) >>> path: pathlib.Path = dirpath / "new_file.arrow" >>> df.write_ipc_stream(path)
DataFrame.write_ipc_stream(
file: str | Path | IO[bytes] | None,
*,
compression: IpcCompression = 'uncompressed',
compat_level: CompatLevel | None = None,
) → BytesIO | None
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/api/polars.DataFrame.write_ipc_stream.html