I have a dataframe in python I did a groupby on, and it contains data per month. It looks like when I extract an exact year:
month | data |
---|---|
1 | 15 |
2 | 24 |
3 | 15 |
4 | 29 |
5 | 55 |
6 | 4 |
7 | 19 |
8 | 10 |
9 | 15 |
10 | 32 |
11 | 53 |
12 | 20 |
However sometimes, it has missing data like:
month | data |
---|---|
1 | 15 |
2 | 24 |
3 | 15 |
4 | 29 |
5 | 55 |
6 | 4 |
7 | 19 |
8 | 10 |
9 | 15 |
11 | 53 |
12 | 20 |
So I was wondering a way to fill in the missing data (10 in this case) and making the default value 0.
I tried to use reindex, but that doesn't fill columns only indexes and I can't find an alternative for column based operations.