@@ -242,11 +242,13 @@ def test_missing_field(self, author_missing_data):
242
242
# unnest records where only the first record has a None value
243
243
result = json_normalize (author_missing_data )
244
244
ex_data = [
245
- {'author_name.first' : np .nan ,
245
+ {'info' : np .nan ,
246
+ 'author_name.first' : np .nan ,
246
247
'author_name.last_name' : np .nan ,
247
248
'info.created_at' : np .nan ,
248
249
'info.last_updated' : np .nan },
249
- {'author_name.first' : 'Jane' ,
250
+ {'info' : None ,
251
+ 'author_name.first' : 'Jane' ,
250
252
'author_name.last_name' : 'Doe' ,
251
253
'info.created_at' : '11/08/1993' ,
252
254
'info.last_updated' : '26/05/2012' }
@@ -351,7 +353,7 @@ def test_json_normalize_errors(self):
351
353
errors = 'raise'
352
354
)
353
355
354
- def test_nonetype_dropping (self ):
356
+ def test_nonetype (self ):
355
357
# GH20030: Checks that None values are dropped in nested_to_record
356
358
# to prevent additional columns of nans when passed to DataFrame
357
359
data = [
@@ -367,7 +369,8 @@ def test_nonetype_dropping(self):
367
369
]
368
370
result = nested_to_record (data )
369
371
expected = [
370
- {'author_name.first' : 'Smith' ,
372
+ {'info' : None ,
373
+ 'author_name.first' : 'Smith' ,
371
374
'author_name.last_name' : 'Appleseed' },
372
375
{'author_name.first' : 'Jane' ,
373
376
'author_name.last_name' : 'Doe' ,
@@ -395,6 +398,7 @@ def test_nonetype_top_level_bottom_level(self):
395
398
}
396
399
result = nested_to_record (data )
397
400
expected = {
401
+ 'id' : None ,
398
402
'location.country.state.id' : None ,
399
403
'location.country.state.town.info.id' : None ,
400
404
'location.country.state.town.info.region' : None ,
@@ -423,6 +427,7 @@ def test_nonetype_multiple_levels(self):
423
427
}
424
428
result = nested_to_record (data )
425
429
expected = {
430
+ 'id' : None ,
426
431
'location.id' : None ,
427
432
'location.country.id' : None ,
428
433
'location.country.state.id' : None ,
0 commit comments