[−][src]Module polars::frame::ser::ipc
(De)serializing Arrows IPC format.
Arrow IPC is a binary format format. It is the recommended way to serialize and deserialize Polars DataFrames as this is most true to the data schema.
Example
use polars::prelude::*; use std::io::Cursor; let s0 = Series::new("days", &[0, 1, 2, 3, 4]); let s1 = Series::new("temp", &[22.1, 19.9, 7., 2., 3.]); let mut df = DataFrame::new(vec![s0, s1]).unwrap(); // Create an in memory file handler. // Vec<u8>: Read + Write // Cursor<T>: Seek let mut buf: Cursor<Vec<u8>> = Cursor::new(Vec::new()); // write to the in memory buffer IPCWriter::new(&mut buf).finish(&mut df).expect("ipc writer"); // reset the buffers index after writing to the beginning of the buffer buf.set_position(0); // read the buffer into a DataFrame let df_read = IPCReader::new(buf).finish().unwrap(); assert!(df.frame_equal(&df_read));
Structs
IPCReader | Read Arrows IPC format into a DataFrame |
IPCWriter | Write a DataFrame to Arrow's IPC format |