Send tables to Rerun
Note: The
send_table
API is currently experimental and may change in future releases.
Rerun now supports sending tabular data to the Rerun Viewer! This feature allows you to visualize and interact with dataframes (encoded as Arrow record batches) directly in the Rerun Viewer environment.
Overview overview
The send_table
API provides a straightforward way to send tabular data to the Rerun Viewer. This is particularly useful for:
- Inspecting dataframes alongside other visualizations
- Debugging data processing pipelines
- Presenting structured data in a readable format
References references
For complete examples of using send_table
, please refer to:
Prerequisites prerequisites
- Rerun SDK (Python)
- PyArrow library
- Pandas
- NumPy
Which can be installed via:
pip install rerun-sdk[notebook] pyarrow pandas numpy
Basic usage basic-usage
Connecting to the Viewer connecting-to-the-viewer
from rerun_bindings import ViewerClient
# Connect to a running Rerun Viewer
client = ViewerClient(addr="rerun+http://0.0.0.0:9876/proxy")
Sending a simple table sending-a-simple-table
import pyarrow as pa
# Create a record batch from a Python dictionary
record_batch = pa.RecordBatch.from_pydict({
"id": [1, 2, 3],
"url": ["https://www.rerun.io", "https://github.com/rerun-io/rerun", "https://crates.io/crates/rerun"],
})
# Send the table to the viewer with an identifier
client.send_table("My Table", record_batch)
Using with Pandas dataframes using-with-pandas-dataframes
You can also send Pandas dataframes by converting them to a record batch:
import pandas as pd
import numpy as np
import pyarrow as pa
# Create a sample DataFrame
dates = pd.date_range("20230101", periods=6)
df = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list("ABCD"))
# Convert to record batch and send to the viewer.
client.send_table("Pandas DataFrame", pa.RecordBatch.from_pandas(df))
Using in Jupyter notebooks using-in-jupyter-notebooks
Rerun provides special support for Jupyter notebooks, you can find more information here: [https://rerun.io/docs/howto/integrations/embed-notebooks]
Note that this API makes use of rr.notebook.Viewer
:
import rerun as rr
import pyarrow as pa
# For inline display
os.environ["RERUN_NOTEBOOK_ASSET"] = "inline"
# Create and display the viewer
viewer = rr.notebook.Viewer(width=1024, height=350)
viewer.display()
# Send table directly to the inline viewer
viewer.send_table("My Table", pa.RecordBatch.from_pydict({
"Column A": [1, 2, 3],
"Column B": ["https://www.rerun.io", "Hello", "World"]
}))
You can also use the native viewer instead of the inline viewer:
os.environ["RERUN_NOTEBOOK_ASSET"] = "serve-local"
# Connect to a running Rerun Viewer
client = ViewerClient(addr="rerun+http://0.0.0.0:9876/proxy")
Current limitations current-limitations
As this is an experimental API, there are several limitations to be aware of:
- Only a single record batch is supported per table
- Tables can't be saved/loaded from files yet (unlike
.rrd
files for recordings) - Integration with the rest of the Rerun API is still in progress
- Rust and C++ support will be added after the API stabilizes
- The API may undergo significant changes as we iterate based on user feedback
What's next whats-next
The send_table
API is still evolving and we plan to tackle all of the limitations mentioned above.
We welcome your feedback and suggestions as we continue to improve this feature!