I have a dictionary of following form:
{'2018': 21.6, '2019': 29.0, '2020': 134.8}
and a pandas dataframe of the following form
| Index | Column1 | Column2 |
|---|---|---|
| Index1 | Name1 | URL1 |
| Index2 | Name2 | URL2 |
| Index3 | Name3 | URL3 |
my aim now is to append the dictionary to a fixed row, say the row with Index2. The result dataframe then should be:
| Index | Column1 | Column2 | 2018 | 2019 | 2020 |
|---|---|---|---|---|---|
| Index1 | Name1 | URL1 | |||
| Index2 | Name2 | URL2 | 21.6 | 29.0 | 134.8 |
| Index3 | Name3 | URL3 |
after that I want append a second and third dictionary of same form into the rows with Index: Index1 and then Index3.
What is the best way to do that with python?