I have four columns in my df:
| Col1 | Col2 | Col3 | Col4 |
|---|---|---|---|
| 1 | 0 | 0 | 1 |
| 5 | 0 | 0 | 0 |
| 6 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
and I want to get to this df:
| Col1 | Col2 | Col3 | Col4 |
|---|---|---|---|
| 2 | 0 | 0 | 1 |
| 5 | 0 | 0 | 0 |
| 6 | 1 | 0 | 1 |
by summing col1 values when the other three columns are all the same.
Edit: I tried
df = df.groupby(["col2","col3","col4"]).col1.sum()
but print(df) clearly shows those columns not summed. Is it possible I should try to force the column to a type first?