Search code examples
pythondictionary-comprehension

Drill down into nested dictionary


This is a very noob question so please forgive me.

Please can someone help me drill down into a nested dictionary.

I'd like to know how to access the dictionary "data" (see data in link) so that I can then analyze it.

Many thanks in advance.

My sample data is here:

I'm using jupyter notbooks.

This is what I have so far:

import json
import pandas as pd

with open('./source/small_data_clean.json') as access_json:
    read_content = json.load(access_json)


type(read_content)

data_access = read_content['data']
data_access

Solution

  • You have to just keep accessing the keys in each level:

    For example:

    data_access['data']
    data_access['data']['0']
    data_access['data']['0']['Pi']