JSON to pandas DataFrame

后端 未结 11 1615
离开以前
离开以前 2020-11-22 05:46

What I am trying to do is extract elevation data from a google maps API along a path specified by latitude and longitude coordinates as follows:

from urllib2         


        
11条回答
  •  旧时难觅i
    2020-11-22 06:35

    Check this snip out.

    # reading the JSON data using json.load()
    file = 'data.json'
    with open(file) as train_file:
        dict_train = json.load(train_file)
    
    # converting json dataset from dictionary to dataframe
    train = pd.DataFrame.from_dict(dict_train, orient='index')
    train.reset_index(level=0, inplace=True)
    

    Hope it helps :)

提交回复
热议问题