I have a data frame, which I created in pandas, grouping by date and summarizing by rides.
date rides
0 2019-01-01 247279
1 2019-01-02 585996
2 2019-01-03 660631
3 2019-01-04 662011
4 2019-01-05 440848
.. ... ...
451 2020-03-27 218499
452 2020-03-28 143305
453 2020-03-29 110833
454 2020-03-30 207743
455 2020-03-31 199623
[456 rows x 2 columns]
My date column is in datetime64[ns].
date datetime64[ns]
rides int64
dtype: object
Now I would like to create another data frame, grouping by month and year (I have data form 2019 and 2020) and summarize by rides.
Ideal output:
Year Month Rides
2019 January 2000000
2020 March 1000000