My dataframe has four columns: date, source, campaign and spend. Now I have duplicated value in date, source and campaign, and I wanted to sum the spend if date, source and campaign (together) is the same. So each day there will be only one source, campaign and spend
and my code is:
marketing_spend_dict_df['spend_update'] =
marketing_spend_dict_df.groupby(['date','source','campaign'])['spend'].sum()
I get an error saying "incompatible index of inserted column with frame index" How could I deal with it? I tried to search on Google but didn't find an optimal solution Thanks!