I have a dataframe that looks like the following: https://i.stack.imgur.com/EfFrp.png
I want to transform this data frame into a nested dictionary where I have for a single key ID, multiple key values corresponding to each Vest Date 1, 2, 3 and 4, and the corresponding value is the Vest Quantity, for example:
dict={'211':{'2019-08-01': 75},
{'2020-08-01': 75},
{'2021-08-01': 75},
{'2022-08-01': 75},
{'2021-12-01': 71},
{'2022-12-01': 72},
{'2023-12-01': 72},
{'2024-12-01': 72},
...
'7674':{'2019-07-01': 64},
{'2020-07-01': 65},
{'2021-07-01': 64},
{'2022-07-01': 64}
}
Then, I would like to sort by dates for each ID.
For the dictionary, I tried first to use melt but it combines all dates and quantities into equal columns, so any help is appreciated!
Thanks in advance!