From 303c340da125b4ac690b687baf5a3071217bdaef Mon Sep 17 00:00:00 2001 From: gfyoung Date: Wed, 11 Jan 2017 21:29:33 -0800 Subject: [PATCH] TST: Add another test for uneven CSV rows Closes gh-9549. --- pandas/io/tests/parser/usecols.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pandas/io/tests/parser/usecols.py b/pandas/io/tests/parser/usecols.py index 96790e872abc3..4875282067fb3 100644 --- a/pandas/io/tests/parser/usecols.py +++ b/pandas/io/tests/parser/usecols.py @@ -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)