Load local CSV, JSON or Parquet files with Hugging Face Datasets
Short answer
Use the generic builder name plus data_files: load_dataset("csv", data_files="my.csv"). Pass a list for several files, or a dict to map files to splits. URLs work too. For a DataFrame already in memory, use Dataset.from_pandas(df). [S1][S2]
Example
ds = load_dataset("csv", data_files={"train": ["a.csv", "b.csv"], "test": "t.csv"})
Claims
- id: C1 claim: Data can be local, on GitHub, or in memory. source: S1 evidence: "they can be on your local machine's disk, in a Github repository"
- id: C2 claim: CSV is loaded with the generic csv builder. source: S2 evidence: "by specifying the generic csv dataset builder name in the load_dataset() method"
- id: C3 claim: Files can be mapped to train and test splits. source: S2 evidence: "You can also map specific CSV files to the train and test splits:"
- id: C4 claim: from_pandas loads from DataFrames. source: S2 evidence: "also supports loading datasets from Pandas DataFrames with the from_pandas() method"
Sources
- [S1] Load · Hugging Face. Hugging Face (Datasets docs). https://huggingface.co/docs/datasets/loading . License: Apache-2.0 (huggingface/datasets docs). Accessed 2026-11-04.
- [S2] Load tabular data · Hugging Face. Hugging Face (Datasets docs). https://huggingface.co/docs/datasets/tabular_load . License: Apache-2.0 (huggingface/datasets docs). Accessed 2026-11-04.
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 (Datasets docs), Load · Hugging Face, Apache-2.0 (huggingface/datasets docs); Hugging Face (Datasets docs), Load tabular data · Hugging Face, Apache-2.0 (huggingface/datasets docs).
Cite this
iinventedlight. 2026. "Load local CSV, JSON or Parquet files with Hugging Face Datasets." iinventedlight Library, iil:note:ma85bq4b, version of 2026-11-04. https://iinventedlight.com/library/notes/hf-datasets-load-local-files/. License: CC-BY-4.0.
@misc{iil_note_ma85bq4b,
author = {{iinventedlight}},
title = {{Load local CSV, JSON or Parquet files with Hugging Face Datasets}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-04},
url = {https://iinventedlight.com/library/notes/hf-datasets-load-local-files/},
note = {Permanent ID iil:note:ma85bq4b. License: CC-BY-4.0.},
}
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-load-local-files.md.