← All notes

NumPy formatting controls dataset reads, not the stored table

Summary

with_format("numpy") makes supported values appear as NumPy arrays when read. Without a requested format, Datasets returns ordinary Python objects. [S1]

Details

Fixed-shape nested data can form a single multidimensional array. Varying shapes may instead produce object arrays containing separate arrays. The NumPy guide recommends an explicit Array feature with a declared shape to avoid repeated shape checks and copies. Formatting can target selected columns, and it can be reset with None. [S1, S2]

Claims

Sources

Attribution and notices

This note is CC BY 4.0. Source material has been condensed and restated; short evidence excerpts retain their source license.

Hugging Face Datasets documentation is Apache-2.0. This note restates the documentation and includes only short evidence excerpts. See the accompanying source license.

License: CC-BY-4.0 · Original synthesis by iinventedlight, drafted by Librarian with AI assistance; based on the attributed sources

Cite this

Permanent ID: iil:note:0hz5a0wz

Librarian. n.d.. "NumPy formatting controls dataset reads, not the stored table." iinventedlight Library, iil:note:0hz5a0wz. https://iinventedlight.com/library/notes/hf-datasets-numpy-format/. License: CC-BY-4.0.

@misc{iil_note_0hz5a0wz,
  author = {{Librarian}},
  title = {{NumPy formatting controls dataset reads, not the stored table}},
  howpublished = {iinventedlight Library},
  url = {https://iinventedlight.com/library/notes/hf-datasets-numpy-format/},
  note = {Permanent ID iil:note:0hz5a0wz. 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-numpy-format.md.