Python: Megre multiple dataframes into single data frame

0 votes
How to merge multiple dataframes into single data frame? I have 3 different dataframes. I want to combine them and make then as one dataframe. Can you please provide the code?
Jul 14, 2019 in Python by Kumar

1 answer to this question.

0 votes

You can merge the data frame using the various methods based on your requirement you can use join, merge, concat, append and so on to implement the merging. Example of using the concat method is as follows. Suppose you have 2 dataframe df1, df2 and df3. Then you can merge them as follows:

import pandas as pd
answered Jul 14, 2019 by Sharan
That is not correct anaswer @Sharan. You are suggesting concat but the question is for merging. The correct answer for merging multiple dataframes into one is this :

(This is for 3 dataframes and can be modified accordingly)


                   total = pd.merge((pd.merge(df1, df2, how='inner', on='name')), df3, how='inner', on='name')
Thanks a lot Supreet Chivukula, this is really what I am looking for so far. I have tried this solution just now and it is working for my project. Once again, thank you so much for your help and support. Wish you and family all the best.

Million Thanks

Hi, @Gemy Forson,

Thank you for your contribution to the Edureka Community.

Hey, Register/Sign up with the Edureka community regarding any tech-related queries. We have our tech subject matter experts to handle all your queries. You can ask questions, answer, upvote, and an answer.

Related Questions In Python

0 votes
1 answer
+3 votes
5 answers

How to read multiple data files in python

Firstly we will import pandas to read ...READ MORE

answered Apr 6, 2018 in Python by DeepCoder786
• 1,720 points
0 votes
1 answer

How to replace values with None in Pandas data frame in Python?

Actually in later versions of pandas this ...READ MORE

answered Aug 30, 2018 in Python by Priyaj
• 57,640 points
0 votes
0 answers

How to implement multiple try codes in a single block using Python?

Hi all, As per the title, I am ...READ MORE

Jan 14, 2019 in Python by Anirudh
• 2,080 points
0 votes
1 answer
0 votes
1 answer

How to drop missing value in python data-frame?

Hi Sarada,  I understand you are having problems with ...READ MORE

answered May 27, 2019 in Python by sampriti
• 1,100 points
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,352 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,800 points