Send dataframes to a recording
If your data is already in a table, you can log the whole table in a single call instead of logging it row by row or column by column.
In Python, rr.send_dataframe logs a table into the active recording, so it's saved with the rest of your data and can be shown next to your other views.
It accepts:
- a pyarrow
Table,RecordBatch, orRecordBatchReader, - a datafusion
DataFrame, - any other object that implements the Arrow C stream interface (
__arrow_c_stream__). Recent versions of pandas and polars implement it, so you can pass their dataframes directly. With older versions, convert first, e.g. withpa.Table.from_pandas(df)ordf.to_arrow()(polars).
Pass the timeline columns as index and the desired entity path for the remaining columns as entity_path:
"""Log an entire table, in a single operation."""
from __future__ import annotations
import numpy as np
import pandas as pd
import rerun as rr
rr.init("rerun_example_send_dataframe", spawn=True)
steps = np.arange(0, 64)
df = pd.DataFrame({
"step": steps,
"sin": np.sin(steps / 10.0),
"cos": np.cos(steps / 10.0),
})
rr.send_dataframe(df, index="step", entity_path="/trig")
Each remaining column becomes a component of that entity, which you can display in a DataframeView.
Like send_columns, this ignores any timeline values set with rr.set_time and bypasses the micro-batcher: only the timelines in the table are added.
To control component types or spread columns across several entities, see Chunks.