I have a json
response from a FastAPI
REST
service
that is generated like this:
dfjson = df.to_json(orient='records', date_format='iso', indent=4)
and looks like this:
[
{
"Date":"2017-12-01T00:00:00.000Z",
"RR":0.0,
"Symbol":"AAPL"
},
{
"Date":"2018-03-12T00:00:00.000Z",
"RR":-0.0655954215,
"Symbol":"AAPL"
},
{
"Date":"2018-03-14T00:00:00.000Z",
"RR":-0.0493162968,
"Symbol":"AAPL"
},
{
"Date":"2018-03-15T00:00:00.000Z",
"RR":-0.0539632781,
"Symbol":"AAPL"
},
...
On the client
side, I am trying to convert this json
into a pandas
dataframe
thus:
df = pd.read_json(response.text)
print(df)
But I get an error:
....
raise ValueError("If using all scalar values, you must pass an index")
ValueError: If using all scalar values, you must pass an index
I am not sure what I am doing wrong?