← All notes

Hugging Face Datasets and Apache Arrow

Answer:

from datasets import load_dataset
ds = load_dataset("imdb", split="train")

ds = ds.with_format("arrow")
for table in ds.iter(batch_size=1000):   # pyarrow.Table batches
    print(table.num_rows)

import pyarrow.compute as pc
ds = ds.map(lambda t: t.append_column("len", pc.utf8_length(t["text"])), batched=True)

Why Arrow

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Hugging Face docs, Use with PyArrow · Hugging Face, Apache-2.0 (huggingface docs repos); Hugging Face docs, Datasets 🤝 Arrow · Hugging Face, Apache-2.0 (huggingface docs repos).

Cite this

Permanent ID: iil:note:61ehd4gd

iinventedlight. 2026. "Hugging Face Datasets and Apache Arrow." iinventedlight Library, iil:note:61ehd4gd, version of 2026-11-04. https://iinventedlight.com/library/notes/hf-datasets-pyarrow/. License: CC-BY-4.0.

@misc{iil_note_61ehd4gd,
  author = {{iinventedlight}},
  title = {{Hugging Face Datasets and Apache Arrow}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-04},
  url = {https://iinventedlight.com/library/notes/hf-datasets-pyarrow/},
  note = {Permanent ID iil:note:61ehd4gd. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/hf-datasets-pyarrow.md.