Adding values of common columns in pandas dataframe

0 votes

Let's say i have two pandas dataframes like this:

Set1: 

   x   y
0  10  20
1  30  40
2  50  60

Set2:

   x   y
0  60  50
1  40  30
2  20  10

Now, these two dataframes have the same column names and same index numbers. I would want to add the corresponding values of each column, so the resultant should look like this:

   x   y
0  70  70
1  70  70
2  70  70
May 30, 2018 in Data Analytics by zombie
• 3,690 points
50 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
Result = Set1.add(Set2)
   x   y
0  70  70
1  70  70
2  70  70

answered May 30, 2018 by Bharani
• 4,550 points

Related Questions In Data Analytics

0 votes
1 answer

How to drop rows of Pandas DataFrame whose value in certain coulmns is NaN

Easy Way: This Way we can easily handle ...READ MORE

answered May 7, 2018 in Data Analytics by DeepCoder786
• 1,700 points
542 views
0 votes
1 answer

How can I find number of columns in a dataframe

To know the number of columns in ...READ MORE

answered Oct 11, 2018 in Data Analytics by ANMOL
• 3,620 points
18 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to rename columns in pandas (Python)?

It is easy by just adding ".columns" ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,700 points
54 views
0 votes
1 answer

What is the Difference in Size and Count in pandas (python)?

The major difference is size includes NaN ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,700 points
542 views
0 votes
2 answers
0 votes
1 answer

Converting a pandas data-frame to a dictionary

Emp_dict=Employee.to_dict('records') You can directly use the 'to_dict()' function ...READ MORE

answered May 23, 2018 in Data Analytics by Bharani
• 4,550 points
714 views
+1 vote
1 answer

Custom Function to replace missing values in a vector with the mean of values

You have missed out on "na.rm=TRUE" inside ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,550 points
31 views
+1 vote
3 answers

Problem with installation of Wordcloud in anaconda

Using Anaconda Python 3.6 version For Windows ...READ MORE

answered Aug 7, 2018 in Data Analytics by Priyaj
• 56,120 points
1,751 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.