I have a list of a dict objects in python, that I am getting from the DB, and it is coming like this, even the "a", "b" and "c" header are coming from db too, and I need to format this to the second pattern, so then I can make use of it
[
{
"a": 3,
"name": "12-09-2022"
},
{
"b": 16,
"name": "09-09-2022"
},
{
"b": 2,
"name": "10-09-2022"
},
{
"b": 25,
"name": "12-09-2022"
},
{
"c": 14,
"name": "12-09-2022"
},
{
"c": 1,
"name": "13-09-2022"
}
]
then I have to format it to this:
[
{
"a": 0,
"b": 16,
"c": 0,
"name": "09-09-2022"
},
{
"a": 0,
"b": 2,
"c": 0,
"name": "10-09-2022"
},
{
"a": 3,
"b": 25,
"c": 14,
"name": "12-09-2022"
},
{
"a": 0,
"b": 0,
"c": 1,
"name": "13-09-2022"
}
]
hint: these data, even the "a","b" and "c" is coming from the db