Python Forum
Merge 2 dataframes but avoid double summing of rows?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Merge 2 dataframes but avoid double summing of rows?
#1
Hi,

I am merging 2 dataframes (DF1 and DF2) with many to many relationships.
The merge works fine but the result duplicates the "Amount" values in every row. How can I avoid this?

[DF3 = pd.merge(DF1,DF2, on=['Project No'],how='left',suffixes=('_left','_right'))]

Any help would be great. Thanks

P.S - Not sure how to attach a sample workbook (excel)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pandas DataFrame combine rows by column value, where Date Rows are NULL rhat398 0 121 May-04-2021, 10:51 PM
Last Post: rhat398
  Indexing [::-1] to Reverse ALL 2D Array Rows, ALL 3D, 4D Array Columns & Rows Python Jeremy7 8 900 Mar-02-2021, 01:54 AM
Last Post: Jeremy7
  merge two dataframes with different number of rows dawid294 5 394 Feb-05-2021, 03:21 PM
Last Post: perfringo
  merge dataframes imatiasmb 1 356 Oct-17-2020, 06:44 PM
Last Post: klllmmm
  Grouping and summing of dataset jef 0 436 Oct-04-2020, 11:03 PM
Last Post: jef
  How to merge three DataFrames based on specific column Mekala 0 412 Sep-08-2020, 02:01 PM
Last Post: Mekala
  Summing a list of numbers Oldman45 6 698 Jul-12-2020, 05:30 PM
Last Post: Oldman45
  filtering and summing data in a text file apexman 3 1,045 Mar-18-2019, 09:25 PM
Last Post: ichabod801
  Merge rows of 2 arrays vipinv23 2 875 Jan-27-2019, 05:45 PM
Last Post: aakashjha001
  summing digits of a number Megabeaz 3 1,287 Jun-29-2018, 02:55 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020