Skip to content

Commit 66c0702

Browse files
gfyoungjorisvandenbossche
authored andcommitted
TST: Add another test for uneven CSV rows (#15114)
Closes gh-9549.
1 parent cb35f46 commit 66c0702

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/io/tests/parser/usecols.py

+10
Original file line numberDiff line numberDiff line change
@@ -465,3 +465,13 @@ def test_uneven_length_cols(self):
465465
[10, 20, 30]])
466466
df = self.read_csv(StringIO(data), header=None, usecols=usecols)
467467
tm.assert_frame_equal(df, expected)
468+
469+
# see gh-9549
470+
usecols = ['A', 'B', 'C']
471+
data = ('A,B,C\n1,2,3\n3,4,5\n1,2,4,5,1,6\n'
472+
'1,2,3,,,1,\n1,2,3\n5,6,7')
473+
expected = DataFrame({'A': [1, 3, 1, 1, 1, 5],
474+
'B': [2, 4, 2, 2, 2, 6],
475+
'C': [3, 5, 4, 3, 3, 7]})
476+
df = self.read_csv(StringIO(data), usecols=usecols)
477+
tm.assert_frame_equal(df, expected)

0 commit comments

Comments
 (0)