-1

I'm not very good at formulating questions so I'm sorry for the title. I hope this example is specific enough; if I have a python pandas dataframe (df) that holds the following data:

Date          Num
01-01-2020    2
01-02-2020    4
01-01-2020    8
01-02-2020    16

how do I add up all of the 'Num' columns that have the same date so the df would look like this:

Date          Num
01-01-2020    10
01-02-2020    20
Henry Yik
  • 22,275
  • 4
  • 18
  • 40

1 Answers1

0

df.groupby("Date").sum()

should do it, thank you Henry Yik