ValueError errors while reading JSON file with pd.read_json

后端 未结 2 934
庸人自扰
庸人自扰 2021-02-20 10:36

I am trying to read JSON file using pandas:

import pandas as pd
df = pd.read_json(\'https://data.gov.in/node/305681/datastore/export/json\')

I

2条回答
  •  北恋
    北恋 (楼主)
    2021-02-20 10:51

    The following listed both the key and value pair for me:

    from urllib.request import urlopen
    import json 
    from pandas.io.json import json_normalize
    import pandas as pd
    import requests
    
    df = json.loads(requests.get('https://api.github.com/repos/akkhil2012/MachineLearning').text)
    
    data = pd.DataFrame.from_dict(df, orient='index')
    
    print(data)
    

提交回复
热议问题