I have data like in a dataframe
CommsId | Id | Amount | Date |
---|---|---|---|
85 | 1 | 10 | 07/10/2020 |
72 | 1 | 15 | 09/09/2021 |
85 | 1 | 25 | 09/09/2021 |
70 | 1 | 30 | 09/09/2021 |
72 | 1 | -15 | 05/11/2020 |
70 | 1 | -30 | 05/11/2020 |
For each date, I want to find the sum of amounts of the latest CommsId as of the date.
Expected output is as below
Date | Sum_Amount | Id |
---|---|---|
07/10/2020 | 10 | 1 |
09/09/2021 | 70 | 1 |
05/11/2021 | 25 | 1 |