I have the following json as web api response:
{"prices": [
{
"start_date": "2016-07-06T00:00:00+02:00",
"end_date": "2016-07-07T00:00:00+02:00",
"values": [
{
"start_date": "2016-07-06T00:00:00+02:00",
"end_date": "2016-07-06T00:30:00+02:00",
"upward_weighted": 45.66,
"downward_weighted": 20.63,
"upward_marginal": 30.1,
"downward_marginal": 12.8,
"updated_date": "2016-07-07T15:45:36+02:00"
},
{
"start_date": "2016-07-06T00:30:00+02:00",
"end_date": "2016-07-06T01:00:00+02:00",
"upward_weighted": 45.66,
"downward_weighted": 20.63,
"upward_marginal": 30.1,
"downward_marginal": 12.8,
"updated_date": "2016-07-07T15:45:36+02:00"
}
]}
]}
And I would to retrieve the prices-> values as a Dataframe.
start_date|end_date|upward_weighted|downward_weighted|...|updated_date|
----------|--------|---------------|-----------------|---|------------|
xxxxxxx |xxxxxxx |xxxxxxxx |xxxxxxx | |xxxxxx |
xxxxxxx |xxxxxxx |xxxxxxxx |xxxxxxx | |xxxxxx |
When I try pandas.read_json(resp.content) I get a wrong dataframe containing only one column 'prices' with dict.
Is it possible to tell pandas.read_json() to make a DataFrame with prices->values ?