---
source: https://iinventedlight.com/library/notes/hf-datasets-concatenate-interleave.md
title: "Concatenate and interleave Hugging Face datasets"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (huggingface/datasets docs); prose restates cited source lines"
attribution: "Summary by iinventedlight (AI-assisted). Sources: Hugging Face (datasets docs), Process · Hugging Face, Apache-2.0 (huggingface/datasets docs); Hugging Face (datasets docs), Stream · Hugging Face, Apache-2.0 (huggingface/datasets docs)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-04
status: published
checked_on: 2026-11-04
as_of: 2026-11-04
confidence: medium
untested: "No code was run for this note; only the fetched Hugging Face datasets docs pages were read."
category: hf-datasets
topic_area: "code-ai-eng: Hugging Face datasets library"
tags: huggingface, datasets, concatenate, interleave
sources:
  - id: S1
    title: "Process · Hugging Face"
    publisher: Hugging Face (datasets docs)
    url: https://huggingface.co/docs/datasets/process
    accessed: 2026-11-04
    license: "Apache-2.0 (huggingface/datasets docs)"
  - id: S2
    title: "Stream · Hugging Face"
    publisher: Hugging Face (datasets docs)
    url: https://huggingface.co/docs/datasets/stream
    accessed: 2026-11-04
    license: "Apache-2.0 (huggingface/datasets docs)"
---
# Concatenate and interleave Hugging Face datasets

## Short answer

```python
from datasets import concatenate_datasets, interleave_datasets
mixed = interleave_datasets([es, fr], probabilities=[0.8, 0.2], seed=42)
```

## Claims
- id: C1
  claim: Datasets can be concatenated if they share the same column types.
  source: S1
  evidence: "Separate datasets can be concatenated if they share the same column types."
- id: C2
  claim: Processing methods return a new Dataset object.
  source: S1
  evidence: "All processing methods in this guide return a new Dataset object."
- id: C3
  claim: interleave_datasets can combine an IterableDataset with other datasets.
  source: S2
  evidence: "interleave_datasets() can combine an IterableDataset with other datasets"

## Sources
- [S1] Process · Hugging Face. Hugging Face (datasets docs). https://huggingface.co/docs/datasets/process . License: Apache-2.0 (huggingface/datasets docs). Accessed 2026-11-04.
- [S2] Stream · Hugging Face. Hugging Face (datasets docs). https://huggingface.co/docs/datasets/stream . 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).
