Read json file as pandas dataframe?

前端 未结 5 1905
夕颜
夕颜 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 06:46

    From your code, it looks like you're loading a JSON file which has JSON data on each separate line. read_json supports a lines argument for data like this:

    data_df = pd.read_json('C:/Users/Alberto/nutrients.json', lines=True)
    

    Note
    Remove lines=True if you have a single JSON object instead of individual JSON objects on each line.

提交回复
热议问题