Skip to content

Commit 1509a22

Browse files
wrenoudy-p
authored and
y-p
committed
TST: corner_case for read_csv with usecols GH5766
1 parent 2485e09 commit 1509a22

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/io/tests/test_parsers.py

+10
Original file line numberDiff line numberDiff line change
@@ -2049,6 +2049,16 @@ def test_usecols(self):
20492049
header=None, usecols=['b', 'c'])
20502050
tm.assert_frame_equal(result2, result)
20512051

2052+
2053+
# 5766
2054+
result = self.read_csv(StringIO(data), names=['a', 'b'],
2055+
header=None, usecols=[0, 1])
2056+
2057+
expected = self.read_csv(StringIO(data), names=['a', 'b', 'c'],
2058+
header=None)
2059+
expected = expected[['a', 'b']]
2060+
tm.assert_frame_equal(result, expected)
2061+
20522062
# length conflict, passed names and usecols disagree
20532063
self.assertRaises(ValueError, self.read_csv, StringIO(data),
20542064
names=['a', 'b'], usecols=[1], header=None)

0 commit comments

Comments
 (0)