1

I have a dataframe which has three columns -> Date, x, y. In that dataframe there are multiple rows with same date value but even for the same dates the values of x & y are different. I want to combine all the dates and make it unique and in the place of 'x' & 'y' I want the summation. I apologise I am new to python, I might be asking a noob question here.

Input: df-->

Date          X    Y
2019-01-01    1    1
2019-01-01    0    1
2019-01-01    0    0
2019-01-01    1    1
2019-01-01    0    1
2019-01-02    1    0
2019-01-02    1    1
2019-01-02    0    1
2019-01-03    0    1
2019-01-03    1    1
2019-01-04    1    0

Expected Output:

Date          X    Y
2019-01-01    2    4
2019-01-02    2    2
2019-01-03    1    2
2019-01-04    1    0
anky
  • 74,114
  • 11
  • 41
  • 70

0 Answers0