I'm trying to make a pivot table of data to look like the expected outcome below (second table) from the data in the first;
To Date From To Quantity
10/11/2020 USA Ireland 5
10/11/2020 USA France 4
11/11/2020 USA France 6
12/11/2020 USA Jamaica 6
12/11/2020 USA France 5
.
.
.
14/02/2021 USA Ireland 65
01/11/2020 01/12/2020 01/01/2021 01/02/2021
Ireland 15 65
France 10
Jamaica 6
I can groupby() it to get the monthly figures.. I would like the pivot table to have the total amount for each country..
df.index = qathist['To Date']
df.index = pd.to_datetime(df.index)
df_m= df.groupby(by=[df.index.year, df.index.month]).sum()
..but then I'm removing other data etc and can't seem to pivot it correctly!
Any help much appreciated!!