I have a pandas dataframe which looks like the following.
df = index| date | amount| type|
0 | 2015 | 1000 | A |
1 | 2015 | 100 | B |
2 | 2016 | 3500 | A |
3 | 2017 | 150 | C |
I want to produce a dataframe with a new column based on types. The result would look like the following.
df = index| date | A | B | C
0 | 2015 | 1000| 100 |0
1 | 2016 | 3500| 0 |0
2 | 2017 | 0 | 0 |150