I have two different data frames with different sizes just like this:
df_web = (['Event Category', 'ID', 'Total Events', 
           'Unique Events', 'Event Value', 'Avg. Value'])
df_app = (['Event Category', 'ID', 'Total Events',
           'Unique Events', 'Event Value', 'Avg. Value']
I'm using pandas to try to merge them in a 'df_final', but I want to sum the values of 'Total Events' which have the same 'ID' , and in the end I would like to have a 'df_final' without duplicates in the ID.
I tried:
df_final_analysis = df_web.groupby(['Event Category', 'ID', 'Total Events', 
                                   'Unique Events', 'Event Value', 'Avg. Value'],
                                    as_index=False)['Total Events'].sum()
But it doesnt give me the result that I want.
For example:
df_web
  Video          A        10
  Video          B         5
  Video          C         1
  Video          F         1
  Video          G         1
  Video          H         1
For df_app:
  Video         A       15
  Video         D        3
  Video         C        1
For the df_final_analysis I want:
  Video         A       25
  Video         B        5
  Video         D        3
  Video         C        2
  Video         F        1
  Video         G        1
  Video         H        1
Is there a elegant way to do this?
 
    