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


Messages In This Thread
Merge 2 dataframes but avoid double summing of rows? - by vinaysalian17 - Jun-03-2020, 01:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Summing up set elements(HH:MM:SS) tester_V 4 1,104 Dec-22-2022, 10:03 AM
Last Post: perfringo
  Check DataFrames with different sorting in columns and rows Foxyskippy 0 753 Nov-19-2022, 07:49 AM
Last Post: Foxyskippy
  The code I have written removes the desired number of rows, but wrong rows Jdesi1983 0 1,602 Dec-08-2021, 04:42 AM
Last Post: Jdesi1983
  Summing up rows and columns plumberpy 3 2,220 Aug-18-2021, 05:46 AM
Last Post: naughtyCat
  Pandas DataFrame combine rows by column value, where Date Rows are NULL rhat398 0 2,083 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 6,963 Mar-02-2021, 01:54 AM
Last Post: Jeremy7
  merge two dataframes with different number of rows dawid294 5 3,983 Feb-05-2021, 03:21 PM
Last Post: perfringo
  merge dataframes imatiasmb 1 1,433 Oct-17-2020, 06:44 PM
Last Post: klllmmm
  Grouping and summing of dataset jef 0 1,608 Oct-04-2020, 11:03 PM
Last Post: jef
  How to merge three DataFrames based on specific column Mekala 0 1,767 Sep-08-2020, 02:01 PM
Last Post: Mekala

Forum Jump:

User Panel Messages

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