I am new to python and not being able to format the output in json style-format.
i have a dataframe df as
col1 col2
0 ABC 2429
1 DEF 702
2 XYZ 2912
3 ABC 619
4 XYZ 3106
5 DEF 1511
I want to generate a list of dictionaries wherein the output is supposed to look something like this:
[
{
"col1":"ABC",
"col2":[2429,619]
},
{
"col1":"DEF",
"col2":[702,1511]
},
{
"col1":"XYZ",
"col2":[2912,3106]
}
]