pandas.merge() is the underlying function used for all merge/join behavior.

DataFrames provide the pandas.DataFrame.merge() and pandas.DataFrame.join() methods as a convenient way to access the capabilities of pandas.merge(). For example, df1.merge(right=df2, ...) is equivalent to pandas.merge(left=df1, right=df2, ...).

These are the main differences between df.join() and df.merge():

  1. lookup on right table: df1.join(df2) always joins via the index of df2, but df1.merge(df2) can join to one or more columns of df2 (default) or to the index of df2 (with right_index=True).
  2. lookup on left table: by default, df1.join(df2) uses the index of df1 and df1.merge(df2) uses column(s) of df1. That can be overridden by specifying df1.join(df2, on=key_or_keys) or df1.merge(df2, left_index=True).
  3. left vs inner join: df1.join(df2) does a left join by default (keeps all rows of df1), but df.merge does an inner join by default (returns only matching rows of df1 and df2).

So, the generic approach is to use pandas.merge(df1, df2) or df1.merge(df2). But for a number of common situations (keeping all rows of df1 and joining to an index in df2), you can save some typing by using df1.join(df2) instead.

Some notes on these issues from the documentation at http://pandas.pydata.org/pandas-docs/stable/merging.html#database-style-dataframe-joining-merging:

merge is a function in the pandas namespace, and it is also available as a DataFrame instance method, with the calling DataFrame being implicitly considered the left object in the join.

The related DataFrame.join method, uses merge internally for the index-on-index and index-on-column(s) joins, but joins on indexes by default rather than trying to join on common columns (the default behavior for merge). If you are joining on index, you may wish to use DataFrame.join to save yourself some typing.

...

These two function calls are completely equivalent:

left.join(right, on=key_or_keys)
pd.merge(left, right, left_on=key_or_keys, right_index=True, how='left', sort=False)
Answer from Matthias Fripp on Stack Overflow
๐ŸŒ
Edlitera
edlitera.com โ€บ blog โ€บ posts โ€บ pandas-merge-dataframes
Intro to Pandas: How to Merge DataFrames | Edlitera
January 6, 2023 - It functions very similarly to a full outer join for those of you familiar with SQL. ... # Perform an outer merge pd.merge( countries, capitals, left_on='Country', right_on='Name', how='outer' ) If you perform the outer merge, you are going to end up creating the following DataFrame: ... In this article, I covered how to perform different types of merges in Pandas.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_sets_join.asp
Python - Join Sets
There are several ways to join two or more sets in Python.
Discussions

python - What is the difference between join and merge in Pandas? - Stack Overflow
Pandas has several methods to deal with these situations, among them merge, join, append, concat, combine, combine_first. More on stackoverflow.com
๐ŸŒ stackoverflow.com
Is it merge, concat or join? How to do that in Python?
Since you used the term "dataframe" I presume you are using Pandas. This article covers the options there well: https://realpython.com/pandas-merge-join-and-concat/ More on reddit.com
๐ŸŒ r/datasets
18
15
May 27, 2021
Join, Merge, and Combine Multiple Datasets Using pandas
You shouldnโ€™t be writing instructional articles if you donโ€™t understand the difference between a method, a function, and a class. More on reddit.com
๐ŸŒ r/pythontips
6
6
July 5, 2023
Pandas merge or concat

I think what you want is easier with merge semantics:

df1.merge(df2,how='outer',on='column1')

	column1	column2_x	column2_y
0	A	0.973952	NaN
1	B	0.910973	-0.012804
2	C	0.122466	NaN
3	D	0.039503	-0.084434
4	E	NaN	        1.320398

To do it with concat semantics you probably want to set column1 as the index and join that way on axis 1:

df1.set_index('column1',inplace=True)
df2.set_index('column1',inplace=True)
pd.concat([df1,df2],join='outer',axis=1)


        column2	        column2
A	0.973952	NaN
B	0.910973	-0.012804
C	0.122466	NaN
D	0.039503	-0.084434
E	NaN	        1.320398
More on reddit.com
๐ŸŒ r/learnpython
1
3
September 13, 2020
๐ŸŒ
AmbitionBox
ambitionbox.com โ€บ interviews โ€บ affine-analytics-question โ€บ merge-vs-join-in-pandas-o4aa9s6r
What are the differences between merge and join ...
Prepare for your next job interview with AmbitionBox. Read 12 Lakh+ interview questions & answers shared by real candidates across 1 Lakh+ companies in India.
๐ŸŒ
Medium
medium.com โ€บ data-science โ€บ the-most-efficient-way-to-merge-join-pandas-dataframes-7576e8b6c5c
Pandas Merge vs Join Performance | TDS Archive
October 31, 2024 - Learn how a Pandas Merge is different than a Join. Optimizing these can increase Merge and Join performance by 30% and reduce ambiguity in your code!
Top answer
1 of 7
539

pandas.merge() is the underlying function used for all merge/join behavior.

DataFrames provide the pandas.DataFrame.merge() and pandas.DataFrame.join() methods as a convenient way to access the capabilities of pandas.merge(). For example, df1.merge(right=df2, ...) is equivalent to pandas.merge(left=df1, right=df2, ...).

These are the main differences between df.join() and df.merge():

  1. lookup on right table: df1.join(df2) always joins via the index of df2, but df1.merge(df2) can join to one or more columns of df2 (default) or to the index of df2 (with right_index=True).
  2. lookup on left table: by default, df1.join(df2) uses the index of df1 and df1.merge(df2) uses column(s) of df1. That can be overridden by specifying df1.join(df2, on=key_or_keys) or df1.merge(df2, left_index=True).
  3. left vs inner join: df1.join(df2) does a left join by default (keeps all rows of df1), but df.merge does an inner join by default (returns only matching rows of df1 and df2).

So, the generic approach is to use pandas.merge(df1, df2) or df1.merge(df2). But for a number of common situations (keeping all rows of df1 and joining to an index in df2), you can save some typing by using df1.join(df2) instead.

Some notes on these issues from the documentation at http://pandas.pydata.org/pandas-docs/stable/merging.html#database-style-dataframe-joining-merging:

merge is a function in the pandas namespace, and it is also available as a DataFrame instance method, with the calling DataFrame being implicitly considered the left object in the join.

The related DataFrame.join method, uses merge internally for the index-on-index and index-on-column(s) joins, but joins on indexes by default rather than trying to join on common columns (the default behavior for merge). If you are joining on index, you may wish to use DataFrame.join to save yourself some typing.

...

These two function calls are completely equivalent:

left.join(right, on=key_or_keys)
pd.merge(left, right, left_on=key_or_keys, right_index=True, how='left', sort=False)
2 of 7
112

I always use join on indices:

import pandas as pd
left = pd.DataFrame({'key': ['foo', 'bar'], 'val': [1, 2]}).set_index('key')
right = pd.DataFrame({'key': ['foo', 'bar'], 'val': [4, 5]}).set_index('key')
left.join(right, lsuffix='_l', rsuffix='_r')

     val_l  val_r
key            
foo      1      4
bar      2      5

The same functionality can be had by using merge on the columns follows:

left = pd.DataFrame({'key': ['foo', 'bar'], 'val': [1, 2]})
right = pd.DataFrame({'key': ['foo', 'bar'], 'val': [4, 5]})
left.merge(right, on=('key'), suffixes=('_l', '_r'))

   key  val_l  val_r
0  foo      1      4
1  bar      2      5
๐ŸŒ
Towards AI
pub.towardsai.net โ€บ differences-between-concat-merge-and-join-with-python-1a6541abc08d
Differences Between concat(), merge() and join() with Python | by Amit Chauhan | Towards AI
November 25, 2023 - There are few methods in pandas that data science people are using to make the data frame in more valuable condition. The methods are divided in terms of rows and columns addition. The methods merge() and join() are working based on common keys and indexes with SQL join method approach.
Find elsewhere
๐ŸŒ
Pandas
pandas.pydata.org โ€บ docs โ€บ reference โ€บ api โ€บ pandas.DataFrame.join.html
pandas.DataFrame.join โ€” pandas 3.0.2 documentation
Join columns of another DataFrame ยท Join columns with other DataFrame either on index or on a key column. Efficiently join multiple DataFrame objects by index at once by passing a list
๐ŸŒ
Pandas
pandas.pydata.org โ€บ docs โ€บ user_guide โ€บ merging.html
Merge, join, concatenate and compare โ€” pandas 3.0.2 documentation
When concatenating DataFrame with named axes, pandas will attempt to preserve these index/column names whenever possible. In the case where all inputs share a common name, this name will be assigned to the result. When the input names do not all agree, the result will be unnamed. The same is true for MultiIndex, but the logic is applied separately on a level-by-level basis. The join keyword specifies how to handle axis values that donโ€™t exist in the first DataFrame.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ pandas โ€บ what-is-the-difference-between-join-and-merge-in-pandas
What is the difference between join and merge in Pandas? - GeeksforGeeks
July 23, 2025 - In Pandas, join() combines DataFrames based on their indices and defaults to a left join, while merge() joins on specified columns and defaults to an inner join. Choosing the right method depends on how your data is aligned.
๐ŸŒ
Python Data Science Handbook
jakevdp.github.io โ€บ PythonDataScienceHandbook โ€บ 03.07-merge-and-join.html
Combining Datasets: Merge and Join | Python Data Science Handbook
Pandas implements several of these fundamental building-blocks in the pd.merge() function and the related join() method of Series and Dataframes.
๐ŸŒ
Towards Data Science
towardsdatascience.com โ€บ home โ€บ latest โ€บ pandas join vs. merge
Pandas Join vs. Merge | Towards Data Science
January 18, 2025 - If we do not want to display any NaNs in our join result, we would do an inner join instead (by specifying "how=inner"). At a basic level, merge more or less does the same thing as join.
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ pandas โ€บ merge
Pandas Merge (With Examples)
The merge operation in Pandas merges two DataFrames based on their indexes or a specified column.The merge operation in Pandas merges two DataFrames based on their indexes or a specified column. The merge() in Pandas works similar to JOINs in SQL. Let's see an example.
๐ŸŒ
Brainly
brainly.in โ€บ computer science โ€บ secondary school
Difference between merge and join in pandas - Brainly.in
December 4, 2023 - While merge() is a module function, .join() is an instance method that lives on your DataFrame.
๐ŸŒ
pandas
pandas.pydata.org โ€บ Pandas_Cheat_Sheet.pdf pdf
with pandas Cheat Sheet http://pandas.pydata.org
pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool, built on top of the Python programming language ยท The full list of companies supporting pandas is available in the sponsors page
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ pandas โ€บ differences between pandas join vs merge
Differences between Pandas Join vs Merge - Spark By {Examples}
June 30, 2025 - In this article, you will learn the difference between pandas join() vs merge() methods on pandas DataFrames with examples and use cases of each. pandas
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ python_pandas โ€บ python_pandas_merging_joining.htm
Python Pandas - Merging/Joining
If a key combination does not appear in either the left or right DataFrame, the values in the joined table will be NaN. The following table summarizes the how options and their SQL equivalents โˆ’ ยท This example demonstrates merging the DataFrame by using the left method. import pandas as pd # Creating the first DataFrame left = pd.DataFrame({ 'id': [1, 2, 3, 4, 5], 'Name': ['Alex', 'Amy', 'Allen', 'Alice', 'Ayoung'], 'subject_id': ['sub1', 'sub2', 'sub4', 'sub6', 'sub5'] }) # Creating the second DataFrame right = pd.DataFrame({ 'id': [1, 2, 3, 4, 5], 'Name': ['Billy', 'Brian', 'Bran', 'Bryce', 'Betty'], 'subject_id': ['sub2', 'sub4', 'sub3', 'sub6', 'sub5'] }) # Merging DataFrames using the left join method print(left.merge(right, on='subject_id', how='left'))
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ pandas-merge-two-dataframe
Pandas merge() - Merging Two DataFrame Objects | DigitalOcean
August 4, 2022 - Pandas DataFrame merge() function is used to merge two DataFrame objects with a database-style join operation. The joining is performed on columns or indexes. If the joining is done on columns, indexes are ignored.
๐ŸŒ
Real Python
realpython.com โ€บ pandas-merge-join-and-concat
Combining Data in pandas With merge(), .join(), and concat() โ€“ Real Python
February 7, 2023 - With outer joins, youโ€™ll merge your data based on all the keys in the left object, the right object, or both. For keys that only exist in one object, unmatched columns in the other object will be filled in with NaN, which stands for Not a Number. You can also see a visual explanation of the various joins in an SQL context on Coding Horror. Now take a look at the different joins in action. Many pandas tutorials provide very simple DataFrames to illustrate the concepts that they are trying to explain.