I have a DataFrame of time-series data, and I'd like to sum the rows which have the same name, eg:
df = DataFrame(Name = ["A", "A", "B", "B"], Day_1 = [0, 2, 1, 4], Day_2 = [2, 3, 5, 7], Day_3 = [1, 3, 6, 2])
|-------|------|-------|-------|-------|
| Row # | Name | Day_1 | Day_2 | Day_3 |
| 1 | "A" | 0 | 2 | 1 |
| 2 | "A" | 2 | 3 | 3 |
| 3 | "B" | 1 | 5 | 6 |
| 4 | "B" | 4 | 7 | 2 |
And I would like it to output:
|-------|------|-------|-------|-------|
| Row # | Name | Day_1 | Day_2 | Day_3 |
| 1 | "A" | 2 | 5 | 4 |
| 2 | "B" | 5 | 12 | 8 |
I have a list of all the different names, but do not know how many rows each name corresponds to.
Thank you!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…