I would like to convert polars::frame::DataFrame
into a serializable format to send it over a REST call. For performance reasons, I would want to avoid JSON or CSV and instead use the arrow format.
While I see that there is a to_arrow()
and from_arrow()
in Python. I didn't find any such functions in Rust.
How do I serialize and de-serialize a Polars DataFrame into binary format?
You can use either the Arrow IPC or the Parquet formats. The differences between them are outlined in this Stack Overflow answer.
For IPC, decoding from a
Read
is done withIpcStreamReader
, and encoding to aWrite
is done withIpcStreamWriter
.For Parquet, decoding is done with
ParquetReader
, and encoding withParquetWriter
.