Read json file as pandas dataframe?

前端 未结 5 1904
夕颜
夕颜 2020-12-15 06:14

I am using python 3.6 and trying to download json file (350 MB) as pandas dataframe using the code below. However, I get the following error:

da         


        
5条回答
  •  -上瘾入骨i
    2020-12-15 07:00

    Using the json module you can parse the json into a python object, then create a dataframe from that:

    import json
    import pandas as pd
    with open('C:/Users/Alberto/nutrients.json', 'r') as f:
        data = json.load(f)
    df = pd.DataFrame(data)
    

提交回复
热议问题