genome_spy.to_arrow_ipc¶
- genome_spy.to_arrow_ipc(data)View on GitHub¶
Serialize a DataFrame-like object as uncompressed Arrow IPC bytes.
- Description:
Supports Polars dataframes, PyArrow tables and record batches, pandas dataframes when the optional
arrowextra is installed, and custom objects with a Polars-compatiblewrite_ipcmethod. The helper intentionally writes uncompressed IPC because GenomeSpy’s Arrow decoder does not support compressed IPC buffers yet.
- Parameters:
data – A supported table or compatible object with
write_ipc(file=None, compression="uncompressed").- Returns:
The complete Arrow IPC file payload as immutable bytes.
- Raises:
TypeError – If the object does not provide a compatible writer or the writer does not return a bytes-like payload.
ValueError – If the writer returns an empty payload.
Example
>>> import polars as pl >>> payload = to_arrow_ipc(pl.DataFrame({"x": [1, 2]})) >>> payload[:6] b'ARROW1'