Skip to content

Ability to Unnest Series of Dicts #30300

Closed
@bnaul

Description

@bnaul

Code Sample, a copy-pastable example if possible

s = pd.Series([{'a': {'b': 1, 'c': 2}}, {'a': {'b': 3, 'c': 4}}], index=[1, 3])
s

1    {'a': {'b': 1, 'c': 2}}
3    {'a': {'b': 3, 'c': 4}}
dtype: object


json_normalize(s)

   a.b  a.c
0    1    2
1    3    4

Problem description

Maybe I'm missing some nuance of nesting or something that would potentially result in a different number of rows...? But it seems like if the rows of the output correspond to those of the input then the index should match as well.

Output of pd.show_versions()

pandas==0.25.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions