Skip to content

Commit

Permalink
TST: Add another test for uneven CSV rows (pandas-dev#15114)
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyoung authored and AnkurDedania committed Mar 21, 2017
1 parent e61547f commit c605110
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pandas/io/tests/parser/usecols.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,3 +465,13 @@ def test_uneven_length_cols(self):
[10, 20, 30]])
df = self.read_csv(StringIO(data), header=None, usecols=usecols)
tm.assert_frame_equal(df, expected)

# see gh-9549
usecols = ['A', 'B', 'C']
data = ('A,B,C\n1,2,3\n3,4,5\n1,2,4,5,1,6\n'
'1,2,3,,,1,\n1,2,3\n5,6,7')
expected = DataFrame({'A': [1, 3, 1, 1, 1, 5],
'B': [2, 4, 2, 2, 2, 6],
'C': [3, 5, 4, 3, 3, 7]})
df = self.read_csv(StringIO(data), usecols=usecols)
tm.assert_frame_equal(df, expected)

0 comments on commit c605110

Please sign in to comment.