(You can assume the date column is datetime)
This may be relevant to the problem, but I also have a list of dates with the following values:
['2018-01-01', '2018-02-01', '2018-03-01',
'2018-04-01', '2018-05-01']
I have the following table:
date arb1 arb2 amount
2018-01-02 Z F 5
2018-01-03 G H 10
2018-02-04 V T 51
2018-03-03 R S 54
I want this output, where each date has been set to the first of its corresponding month:
date arb1 arb2 amount
2018-01-01 Z F 5
2018-01-01 G H 10
2018-02-01 V T 51
2018-03-01 R S 54
Bonus (not required): What I'm actually trying to do is add up the amounts after grouping by date (the month), arb1, and arb2, and the final output has each date as the first of the month. I figured an easy way to get here would be to first change each date to the first of the month, but if there is an easy way to do this in pandas then the above steps aren't required and you can skip to this instead