[Python] JSON to Pandas Dataframe with null values and missing columns

Discussão em 'Python' iniciado por Stack, Setembro 24, 2024.

  1. Stack

    Stack Membro Participativo

    I am working with a JSON file that is designed as such:

    f = {'results':
    [{'tables':
    [{'rows': [{'column1': 'dog', 'column2': 'blue', 'column3': 'sad'},
    { 'column2': 'red', 'column3': 'happy'},
    {'column1': 'bird', 'column2': 'green'}]
    }]}]}


    DESIRED pandas dataframe that accounts for rows with missing columns:

    column1 column2 column3
    dog blue sad
    red happy
    bird green


    Any suggestions is greatly appreciated.

    Continue reading...

Compartilhe esta Página