Date Amount
1/2/2018 149
1/2/2018 50
1/2/2018 300
1/2/2018 50
1/3/2018 50
1/3/2018 50
1/3/2018 150
1/3/2018 150
1/3/2018 150
1/3/2018 300
1/4/2018 125
1/4/2018 129
1/4/2018 149
1/4/2018 250
Above is the data I am working with. I would like to turn this data into monthly sales but am having trouble with my code. Do I need to first define the date? Below is what I have so far but am getting these results and not the sum for amount.
df.Date = pd.to_datetime(df.Date)
df.set_index('Date', inplace=True)
df.resample('MS').sum()
Date Year
2018-01-01 131016.0
2018-02-01 147121.0
2018-03-01 167221.0
2018-04-01 187418.0