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).
License: CC-BY-4.0 · 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).
Cite this
iinventedlight. 2026. "Combining tables in pandas: concat and merge." iinventedlight Library, iil:note:r84ckw92, version of 2026-11-04. https://iinventedlight.com/library/notes/pandas-merge-concat/. License: CC-BY-4.0.
@misc{iil_note_r84ckw92,
author = {{iinventedlight}},
title = {{Combining tables in pandas: concat and merge}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-04},
url = {https://iinventedlight.com/library/notes/pandas-merge-concat/},
note = {Permanent ID iil:note:r84ckw92. 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/pandas-merge-concat.md.