---
source: https://iinventedlight.com/library/notes/pandas-merge-concat.md
title: "Combining tables in pandas: concat and merge"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (pandas-dev/pandas LICENSE; Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team; Copyright (c) 2011-2026, Open source contributors; https://github.com/pandas-dev/pandas/blob/main/LICENSE); prose restates or closely paraphrases cited source lines"
license_family: pandas-bsd3
rule_check: "needs rule check (family not in auto-publish rule; check.mjs auto-approves only usgov and arxiv-ccby)"
attribution: "Summary by iinventedlight (AI-assisted). Sources: pandas docs, Merge, join, concatenate and compare — pandas 3.1.1 documentation, BSD-3-Clause (pandas-dev/pandas LICENSE; Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team; Copyright (c) 2011-2026, Open source contributors; https://github.com/pandas-dev/pandas/blob/main/LICENSE); pandas docs, How to combine data from multiple tables — pandas 3.1.1 documentation, BSD-3-Clause (pandas-dev/pandas LICENSE; Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team; Copyright (c) 2011-2026, Open source contributors; https://github.com/pandas-dev/pandas/blob/main/LICENSE)."
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 documentation pages were read."
category: coding-references
topic_area: "code-ai-eng: pandas"
tags: ['pandas', 'merge', 'concat', 'join']
sources:
  - id: S1
    title: "Merge, join, concatenate and compare — pandas 3.1.1 documentation"
    publisher: pandas docs
    url: https://pandas.pydata.org/docs/user_guide/merging.html
    accessed: 2026-11-04
    license: "BSD-3-Clause (pandas-dev/pandas LICENSE; Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team; Copyright (c) 2011-2026, Open source contributors; https://github.com/pandas-dev/pandas/blob/main/LICENSE)"
  - id: S2
    title: "How to combine data from multiple tables — pandas 3.1.1 documentation"
    publisher: pandas docs
    url: https://pandas.pydata.org/docs/getting_started/intro_tutorials/08_combine_dataframes.html
    accessed: 2026-11-04
    license: "BSD-3-Clause (pandas-dev/pandas LICENSE; Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team; Copyright (c) 2011-2026, Open source contributors; https://github.com/pandas-dev/pandas/blob/main/LICENSE)"
---
# Combining tables in pandas: concat and merge

**Answer:** In pandas, merge() implements common SQL style joining operations. (S1)

## concat

- By default concatenation is along axis 0, so the resulting table combines the rows of the input tables. (S2)
- You can concatenate a mix of Series and DataFrame objects. (S1)
- The keys argument adds another axis level to the resulting index or column, creating a MultiIndex that associates specific keys with each original DataFrame. (S1)
- concat() makes a full copy of the data, and iteratively reusing concat() can create unnecessary copies. (S1)
- When concatenating DataFrame with named axes, pandas will attempt to preserve these index/column names whenever possible. (S1)

## merge

- The merge function supports multiple join options similar to database-style operations. (S2)
- In the tutorial example, both tables have the column location in common, which is used as a key to combine the information. (S2)
- By choosing the left join, only the locations available in the left table are kept. (S2)

## Claims
- id: C1
  claim: merge() implements SQL style joins.
  source: S1
  evidence: "merge() implements common SQL style joining operations."
- id: C2
  claim: concat() makes a full copy of the data.
  source: S1
  evidence: "concat() makes a full copy of the data"
- id: C3
  claim: Concatenation defaults to axis 0.
  source: S2
  evidence: "By default concatenation is along axis 0"
- id: C4
  claim: merge supports database-style join options.
  source: S2
  evidence: "supports multiple join options similar to database-style operations."

## Sources
- [S1] Merge, join, concatenate and compare — pandas 3.1.1 documentation. pandas docs. https://pandas.pydata.org/docs/user_guide/merging.html . License: BSD-3-Clause (pandas-dev/pandas LICENSE; Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team; Copyright (c) 2011-2026, Open source contributors; https://github.com/pandas-dev/pandas/blob/main/LICENSE). Accessed 2026-11-04.
- [S2] How to combine data from multiple tables — pandas 3.1.1 documentation. pandas docs. https://pandas.pydata.org/docs/getting_started/intro_tutorials/08_combine_dataframes.html . License: BSD-3-Clause (pandas-dev/pandas LICENSE; Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team; Copyright (c) 2011-2026, Open source contributors; https://github.com/pandas-dev/pandas/blob/main/LICENSE). Accessed 2026-11-04.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
