Skip to content

How to access nested dictionaries?  #8

@aiqc

Description

@aiqc

I have a file of records structured like so:

[
    {
        "case_id": 1,
        "demographic": {
            "race": "white",
            "age": 55,
        }
    },
    {
        "case_id": 2,
        "demographic": {
            "race": "white",
            "age": 65,
        }
    },
    {
        "case_id": 3,
        "demographic": {
            "race": "black",
            "age": 57,
        }
    }
]

I can access case id fine

q.where('case_id', '=', 1).get()

But I can't seem to use at to drill into the demographic key

q.at('demographic')

"KeyError: 'Key not exists'"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions