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
Top answer
1 of 7
540

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
113

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
🌐
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.
Discussions

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
Using Pandas Merge or Join?
It's really hard to be definitive if you don't provide the source data. Different dataframe structures will lead to different solutions. Presumably, dataframes A and B both have a customer ID column that is not the index of the dataframes. In that case, I would do MergedDF = A.merge(B, how = "inner", left_on = "customerID", right_on = "customerID"), with parameters changing depending on how your data actually look. More on reddit.com
🌐 r/learnpython
3
1
April 13, 2020
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
🌐
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
🌐
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.
🌐
Medium
blog.dataengineerthings.org › joining-data-in-pandas-merge-vs-join-436757cdd81e
Joining data in pandas: merge vs. join | by Kerry Parker | Data Engineer Things
December 28, 2024 - Typically when combining dataframes in pandas, I would have a quick google and head to the documentation to check the syntax — I always got mixed up which to use and whether the function is applied to the left dataframe or if the left dataframe is the first parameter. These days, merge is my go-to over join and in this article I will explain to you why.
🌐
Towards Data Science
towardsdatascience.com › home › latest › pandas join vs. merge
Pandas Join vs. Merge | Towards Data Science
January 18, 2025 - The merge method is more versatile and allows us to specify columns besides the index to join on for both dataframes. If the index gets reset to a counter post merge, we can use set_index to change it back.
🌐
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.
Find elsewhere
🌐
Pandas
pandas.pydata.org › docs › user_guide › merging.html
Merge, join, concatenate and compare — pandas 3.0.2 documentation
merge() performs join operations similar to relational databases like SQL. Users who are familiar with SQL but new to pandas can reference a comparison with SQL.
🌐
InfluxData
influxdata.com › home › pandas merge operation: what it is and when to use it
Pandas Merge Operation: What It Is and When to Use It | InfluxData
November 20, 2023 - The pandas library has a method called merge() for combining DataFrames or named Series into a singular DataFrame for better data analysis. The pandas merge operation combines two or more DataFrame objects based on columns or indexes in a similar fashion as join operations performed on databases.
🌐
Plain English
python.plainenglish.io › optimizing-pandas-merge-vs-join-for-faster-data-processing-3bfe8bb12aea
Optimizing Pandas: Merge vs. Join for Faster Data Processing
October 13, 2024 - This is a column-based operation, where Pandas looks up and combines the rows based on the common column. While pd.merge() is versatile, it is not the most efficient when working with large datasets. The column-based lookup process can be slow, especially when the size of the DataFrame grows. As the DataFrame size increases (e.g., from 1 million rows to 10 million rows), the time taken to merge the DataFrames increases almost exponentially. Join Medium for free to get updates from this writer.
🌐
EDUCBA
educba.com › home › software development › software development tutorials › top differences tutorial › pandas merge vs join
Pandas Merge vs Join | Difference between Pandas Merge and Join
April 11, 2023 - The basic difference between merge and join operation comes from the key or a common code which is been used by the two operations. For pandas join whenever we give a command to like df1.join(df2) the joining takes place at the index level of df2.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Medium
medium.com › @rohanmistry231 › pandas-merge-vs-concat-vs-join-the-ultimate-guide-for-data-professionals-842e5e7fb7eb
pandas merge() vs concat() vs join(): The Ultimate Guide for Data Professionals | by Rohan Mistry | Medium
August 30, 2025 - It allows merging DataFrames based on one or more keys. Combining datasets on common columns or indexes. Performing SQL-like joins: inner, outer, left, right.
🌐
Real Python
realpython.com › pandas-merge-join-and-concat
Combining Data in pandas With merge(), .join(), and concat() – Real Python
February 7, 2023 - In this step-by-step tutorial, you'll learn three techniques for combining data in pandas: merge(), .join(), and concat(). Combining Series and DataFrame objects in pandas is a powerful way to gain new insights into your data.
🌐
Studymachinelearning
studymachinelearning.com › difference-between-merge-join-and-concatenate
Difference between Merge, join, and concatenate – Study Machine Learning
The merge() and join() methods are the DataFrame method, not a series method. The concat() method is the pandas’ method which provides the functionality to combine the pandas’ objects such as DataFrame and Series.
🌐
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'))
🌐
Plain English
python.plainenglish.io › difference-between-join-and-merge-in-pandas-53565d37840d
Difference between `join()` and `merge()` in Pandas | by Ishaq | Python in Plain English
November 23, 2023 - In this example, the `join()` method ... contains columns from both. On the other hand, the `merge()` method in Pandas is a more general-purpose tool for combining DataFrames....
🌐
Data Science Parichay
datascienceparichay.com › home › blog › pandas – join vs merge
Pandas - Join vs Merge - Data Science Parichay
January 5, 2021 - The join() function is generally used to join dataframes on index whereas the merge() function is a more versatile function that lets you join dataframes on indexes as well as columns.
🌐
Reddit
reddit.com › r/learnpython › using pandas merge or join?
r/learnpython on Reddit: Using Pandas Merge or Join?
April 13, 2020 -

I was reading up on Pandas merge and Join and couldn't figure out which to use in my situation.

I have two data frames one that is (A)1000 x 365 and the other is (B)1000 x 200

1000 represent unique index customer ID, and the columns are 365 days of a year

A is a dataframe filled with nan values. while B is a dataframe with integer values.

I want to "copy" B onto A.

I'm not sure how to approach this. I've tried messing with the arguments like right_index = True, left_index = True, etc.

🌐
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.