@@ -163,11 +163,11 @@ def _json_normalize(
163
163
>>> data = [{'id': 1, 'name': {'first': 'Coleen', 'last': 'Volk'}},
164
164
... {'name': {'given': 'Mose', 'family': 'Regner'}},
165
165
... {'id': 2, 'name': 'Faye Raker'}]
166
- >>> pandas .json_normalize(data)
167
- id name name.family name.first name.given name.last
168
- 0 1.0 NaN NaN Coleen NaN Volk
169
- 1 NaN NaN Regner NaN Mose NaN
170
- 2 2.0 Faye Raker NaN NaN NaN NaN
166
+ >>> pd .json_normalize(data)
167
+ id name.first name.last name.given name.family name
168
+ 0 1.0 Coleen Volk NaN NaN NaN
169
+ 1 NaN NaN NaN Mose Regner NaN
170
+ 2 2.0 NaN NaN NaN NaN Faye Raker
171
171
172
172
>>> data = [{'id': 1,
173
173
... 'name': "Cole Volk",
@@ -176,11 +176,11 @@ def _json_normalize(
176
176
... 'fitness': {'height': 130, 'weight': 60}},
177
177
... {'id': 2, 'name': 'Faye Raker',
178
178
... 'fitness': {'height': 130, 'weight': 60}}]
179
- >>> pandas .json_normalize(data, max_level=0)
180
- fitness id name
181
- 0 {'height': 130, 'weight': 60} 1.0 Cole Volk
182
- 1 {'height': 130, 'weight': 60} NaN Mose Reg
183
- 2 {'height': 130, 'weight': 60} 2.0 Faye Raker
179
+ >>> pd .json_normalize(data, max_level=0)
180
+ id name fitness
181
+ 0 1.0 Cole Volk {'height': 130, 'weight': 60}
182
+ 1 NaN Mose Reg {'height': 130, 'weight': 60}
183
+ 2 2.0 Faye Raker {'height': 130, 'weight': 60}
184
184
185
185
Normalizes nested data up to level 1.
186
186
@@ -191,11 +191,11 @@ def _json_normalize(
191
191
... 'fitness': {'height': 130, 'weight': 60}},
192
192
... {'id': 2, 'name': 'Faye Raker',
193
193
... 'fitness': {'height': 130, 'weight': 60}}]
194
- >>> pandas .json_normalize(data, max_level=1)
195
- fitness.height fitness.weight id name
196
- 0 130 60 1.0 Cole Volk
197
- 1 130 60 NaN Mose Reg
198
- 2 130 60 2.0 Faye Raker
194
+ >>> pd .json_normalize(data, max_level=1)
195
+ id name fitness.height fitness.weight
196
+ 0 1.0 Cole Volk 130 60
197
+ 1 NaN Mose Reg 130 60
198
+ 2 2.0 Faye Raker 130 60
199
199
200
200
>>> data = [{'state': 'Florida',
201
201
... 'shortname': 'FL',
@@ -208,7 +208,7 @@ def _json_normalize(
208
208
... 'info': {'governor': 'John Kasich'},
209
209
... 'counties': [{'name': 'Summit', 'population': 1234},
210
210
... {'name': 'Cuyahoga', 'population': 1337}]}]
211
- >>> result = pandas .json_normalize(data, 'counties', ['state', 'shortname',
211
+ >>> result = pd .json_normalize(data, 'counties', ['state', 'shortname',
212
212
... ['info', 'governor']])
213
213
>>> result
214
214
name population state shortname info.governor
@@ -219,7 +219,7 @@ def _json_normalize(
219
219
4 Cuyahoga 1337 Ohio OH John Kasich
220
220
221
221
>>> data = {'A': [1, 2]}
222
- >>> pandas .json_normalize(data, 'A', record_prefix='Prefix.')
222
+ >>> pd .json_normalize(data, 'A', record_prefix='Prefix.')
223
223
Prefix.0
224
224
0 1
225
225
1 2
0 commit comments