pandas 1.4.2

ParametersReturnsBackRef
nested_to_record(ds, prefix: 'str' = '', sep: 'str' = '.', level: 'int' = 0, max_level: 'int | None' = None)

Converts a nested dict into a flat dict ("record"), unlike json_normalize, it does not attempt to extract a subset of the data.

Parameters

ds : dict or list of dicts
prefix: the prefix, optional, default: "" :
sep : str, default '.'

Nested records will generate names separated by sep, e.g., for sep='.', { 'foo' : { 'bar' : 0 } } -> foo.bar

level: int, optional, default: 0 :

The number of levels in the json string.

max_level: int, optional, default: None :

The max depth to normalize.

versionadded

Returns

d - dict or list of dicts, matching `ds`

A simplified json_normalize

Examples

This example is valid syntax, but we were not able to check execution
>>> nested_to_record(
...  dict(flat1=1, dict1=dict(c=1, d=2), nested=dict(e=dict(c=1, d=2), d=2))
... ) {'flat1': 1, 'dict1.c': 1, 'dict1.d': 2, 'nested.e.c': 1, 'nested.e.d': 2, 'nested.d': 2}
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.io.json._normalize.nested_to_record

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/io/json/_normalize.py#39
type: <class 'function'>
Commit: