my question is the following:
I have this dataframe in pandas:
| AVG_SCORE | ASD_SCORE | QWE_AVG | OPO_SCORE | HAHA_SCORE |
|---|---|---|---|---|
| -0.487 | -0.560 | -0.171 | -0.581 | 0.063 |
| 388545 | 388545 | 388545 | 388545 | 388545 |
and I want to get a JSON to pass to a POST request from an external endpoint.
The endopint only contemplates the following body, then what I want is to be able to obtain from the dataframe the desired JSON format. Can someone help me? I'm using python 3.9 and pandas:
JSON FORMAT:
{
"label_1": "description_harcode_here_1",
"description_harcode_here_2" : [
{
"field": "AVG_SCORE",
"avg": -0.487,
"count": 388545
},
{
"field": "ASD_SCORE",
"avg": -0.560,
"count": 388545
},
{
"field": "QWE_AVG",
"avg": -0.171,
"count": 388545
},
{
"field": "OPO_SCORE",
"avg": -0.581,
"count": 388545
},
{
"field": "HAHA_SCORE",
"avg": 0.063,
"count": 388545
}
]
}
Thank