Skip to content

Commit

Permalink
TST: read_csv to nullable int dtype (pandas-dev#25472)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreg committed Oct 17, 2021
1 parent d7b8d9c commit 520261b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pandas/tests/io/parser/dtypes/test_dtypes_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,23 @@ def test_dtype_multi_index(all_parsers):
)

tm.assert_frame_equal(result, expected)


def test_nullable_int_dtype(all_parsers, any_int_ea_dtype):
# GH 25472
parser = all_parsers
dtype = any_int_ea_dtype

data = """a,b,c
,3,5
1,,6
2,4,"""
expected = DataFrame(
{
"a": pd.array([pd.NA, 1, 2], dtype=dtype),
"b": pd.array([3, pd.NA, 4], dtype=dtype),
"c": pd.array([5, 6, pd.NA], dtype=dtype),
}
)
actual = parser.read_csv(StringIO(data), dtype=dtype)
tm.assert_frame_equal(actual, expected)

0 comments on commit 520261b

Please sign in to comment.