I have a json as shown below and I need to convert this to table format. (all post about this did not help me and I think is because the json structure)
I tried using pandas but it is not working as I expected.
I need something like this
id, t_id, value, date_timestamp, type
179328741654819, 963852456741, 499.66, 2020-09-22T15:18:17, in
This is my code: (I am using Jupyter notebook)
result
I tried using pandas but it is not working as I expected.
I need something like this
id, t_id, value, date_timestamp, type
179328741654819, 963852456741, 499.66, 2020-09-22T15:18:17, in
This is my code: (I am using Jupyter notebook)
import json import pandas as pd from IPython.display import display # load json file pd_object = pd.read_json('file.json',typ='series') df = pd.DataFrame(pd_object) display(df)But it show only one columnresult
Output:0 {'id': '179328741654819', 't_values'... 200 rows × 1 columnsThe json structure is:Output:[ { "id": "179328741654819", "t_values": [ { "t_id": "963852456741", "value": "499.66", "date_timestamp": "2020-09-22T15:18:17", "type": "in" }, { "t_id": "852951753456", "value": "1386.78", "date_timestamp": "2020-10-31T14:46:44", "type": "in" } ] }, { "id": "823971648264792", "t_values": [ { "t_id": "753958561456", "value": "672.06", "date_timestamp": "2020-03-16T22:41:16", "type": "in" }, { "t_id": "321147951753", "value": "773.88", "date_timestamp": "2020-05-08T18:29:31", "type": "out" }, { "t_id": "258951753852", "value": "733.13", "date_timestamp": null, "type": "in" } ] } ] 