I have a data frame that consists of :
DATE | X. |
---|---|
1982-09-30 00:00:00 | 0 |
1982-10-31 00:00:00 | -0.75 |
1982-11-30 00:00:00 | -0.5 |
1982-12-31 00:00:00 | -0.5 |
1983-01-31 00:00:00 | 0 |
... | 0.8 |
2022-01-09 00:00:00 | 0.8 |
From this dataframe, I would like to have a table with this format :
January | February | ... | December | |
---|---|---|---|---|
1982 | 1 | 0 | 0.5 | -1.0 |
1983 | 1 | 0 | 0.5 | -1.0 |
... | 1 | 0 | 0.5 | -1.0 |
2022 | 1 | 0 | 0.5 | -1.0 |
where each number inside the table is the sum of line/column intersection ie for January/1982 : the sum of the data for January 1982, etc..