I'm trying to split a json response in pandas into different columns, so far I have this but I don't find an effective way how to do it, I already tried several solutions but I can't separate the object correctly.
This is a sample of the data
{
"codeId": "fc-5599",
"financeInfo": [
{
"date": "2022-01-30",
"totalReturn": 0.022425456852
},
{
"date": "2022-01-30",
"totalReturn": 0.022425456852
},
{
"date": "2022-01-30",
"totalReturn": 0.022425456852
},
{
"date": "2022-01-30",
"totalReturn": 0.022425456852
},
{
"date": "2022-01-30",
"totalReturn": 0.022425456852
}
]
}
df = pd.DataFrame(s, columns = ["codeId","financeInfo"])
df.to_csv('data_fin.csv', index=False)
I have this:
example of the output I want to achieve.
Any idea of how improve this code?