Skip to content

Commit 5c21bd0

Browse files
committed
TST: read_csv to nullable int dtype (pandas-dev#25472)
1 parent be928eb commit 5c21bd0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pandas/tests/io/parser/dtypes/test_dtypes_basic.py

+20
Original file line numberDiff line numberDiff line change
@@ -314,3 +314,23 @@ def test_dtype_multi_index(all_parsers):
314314
)
315315

316316
tm.assert_frame_equal(result, expected)
317+
318+
319+
def test_nullable_int_dtype(all_parsers, any_int_ea_dtype):
320+
# GH 25472
321+
parser = all_parsers
322+
dtype = any_int_ea_dtype
323+
324+
data = """a,b,c
325+
,3,5
326+
1,,6
327+
2,4,"""
328+
expected = DataFrame(
329+
{
330+
"a": pd.array([pd.NA, 1, 2], dtype=dtype),
331+
"b": pd.array([3, pd.NA, 4], dtype=dtype),
332+
"c": pd.array([5, 6, pd.NA], dtype=dtype),
333+
}
334+
)
335+
actual = parser.read_csv(StringIO(data), dtype=dtype)
336+
tm.assert_frame_equal(actual, expected)

0 commit comments

Comments
 (0)