Skip to content

Commit 76d2d91

Browse files
committed
TST: updated test purposes and how nan is declared (pandas-dev#20030)
1 parent e232067 commit 76d2d91

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pandas/tests/io/json/test_normalize.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,14 @@ def test_non_ascii_key(self):
238238
tm.assert_frame_equal(result, expected)
239239

240240
def test_missing_field(self, author_missing_data):
241+
# GH20030: Checks for robustness of json_normalize - should
242+
# unnest records where only the first record has a None value
241243
result = json_normalize(author_missing_data)
242244
ex_data = [
243-
{'author_name.first': float('nan'),
244-
'author_name.last_name': float('nan'),
245-
'info.created_at': float('nan'),
246-
'info.last_updated': float('nan')},
245+
{'author_name.first': np.nan,
246+
'author_name.last_name': np.nan,
247+
'info.created_at': np.nan,
248+
'info.last_updated': np.nan},
247249
{'author_name.first': 'Jane',
248250
'author_name.last_name': 'Doe',
249251
'info.created_at': '11/08/1993',
@@ -350,6 +352,8 @@ def test_json_normalize_errors(self):
350352
)
351353

352354
def test_nonetype_dropping(self):
355+
# GH20030: Checks that None values are dropped in nested_to_record
356+
# to prevent additional columns of nans when passed to DataFrame
353357
data = [
354358
{'info': None,
355359
'author_name':

0 commit comments

Comments
 (0)