Read json file as pandas dataframe?

前端 未结 5 1911
夕颜
夕颜 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条回答
  •  感动是毒
    2020-12-15 07:02

    if you want to convert it into an array of JSON objects, I think this one will do what you want

    import json
    data = []
    with open('nutrients.json', errors='ignore') as f:
        for line in f:
            data.append(json.loads(line))
    print(data[0])
    

提交回复
热议问题