Skip to content

Commit da2b086

Browse files
authored
TST: Add test for to_dict converting masked to python types (#50874)
1 parent bf76acc commit da2b086

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/frame/methods/test_to_dict.py

+10
Original file line numberDiff line numberDiff line change
@@ -485,3 +485,13 @@ def test_to_dict_na_to_none(self, orient, expected):
485485
df = DataFrame({"a": [1, NA]}, dtype="Int64")
486486
result = df.to_dict(orient=orient)
487487
assert result == expected
488+
489+
def test_to_dict_masked_native_python(self):
490+
# GH#34665
491+
df = DataFrame({"a": Series([1, 2], dtype="Int64"), "B": 1})
492+
result = df.to_dict(orient="records")
493+
assert type(result[0]["a"]) is int
494+
495+
df = DataFrame({"a": Series([1, NA], dtype="Int64"), "B": 1})
496+
result = df.to_dict(orient="records")
497+
assert type(result[0]["a"]) is int

0 commit comments

Comments
 (0)