benchmarks / examples /01_pandas.py
OpenChainBench's picture
snapshot 2026-06-22 (rows: h=26 p=254 ts=1842)
f7ff1b4 verified
Raw
History Blame Contribute Delete
617 Bytes
"""
Load the OCB headlines feed with pandas via the Hugging Face datasets
library. Good when you want a familiar DataFrame and the dataset is
small enough to fit in memory (it is).
"""
from datasets import load_dataset
ds = load_dataset(
"OpenChainBench/benchmarks",
"headlines",
split="train",
)
df = ds.to_pandas()
# Latest snapshot only
latest = df["snapshot_date"].max()
today = df[df["snapshot_date"] == latest]
# Top 10 benchmarks by sample size today
print(
today.sort_values("sample_size", ascending=False)[
["slug", "leader_name", "value", "unit", "sample_size"]
].head(10)
)