I have the following Pandas pivot
Apple Green 5
Red 3
Yellow 4
Grapes Red 1
Green 3
and want to convert this data to JSON like follows:
{
Apple: {
Green : 5,
Red: 3,
Yellow: 4,
},
Grapes:{
Red : 1,
Green: 3
}
}
How do I accomplish this? I have tried to_json(), which returns a different format.