read_json instead of open and json.load

Viewed 34

I'm currenly loading a DataFrame as follows:

with open('walcl.json', 'r') as file:
    df_walcl = pd.DataFrame(json.load(file)['observations'])

Is there a way to perform the equivalent using only pd.read_json?

I.e. something like this:

df_walcl = pd.read_json('walcl.json', ...)

Note that I'm loading the data from the observations component.

0 Answers
Related