I have this dataframe sales_df:
id year month total_sales
0 2020 1 200
1 2019 12 866474119
1 2019 10 555
1 2019 11 13073203
1 2020 2 5255259695
1 2020 1 13622027370
From this, I want to make a dictionnary, as follow:
[
{
"2020": {
"1": "200"
},
"id": "0"
},
{
"2019": {
"10": "555",
"11": "13073203",
"12": "866474119"
},
"2020": {
"1": "13553473101",
"2": "6000"
},
"id": "1"
}
]
i convert df to pandas achchive the output i want know without convert how to achive that