I have a dataframe of the form:
For same values of col1 and col2 (for example, A B), I want to add all values in the col3 of the dataframe such that only one row of that form (A B) remains and all values in col3 correspond to those are added.
The result would look like:
I tried:
df.groupby(['col1', 'col2'], axis=0, as_index=True).sum()
but it gave me:
which is not exactly what I am looking for. Please help and advise. Thanks in advance.