Skip to content

Commit 4434310

Browse files
garaudwesm
authored andcommitted
BUG: Add test to read_csv with usecols and regexp separator. #2733
1 parent 28e2a38 commit 4434310

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
@@ -1868,6 +1868,16 @@ def test_usecols_implicit_index_col(self):
18681868

18691869
tm.assert_frame_equal(result, expected)
18701870

1871+
def test_usecols_regexp_separator(self):
1872+
# #2733
1873+
data = 'a b c\n4 apple bat 5.7\n8 orange cow 10'
1874+
1875+
result = self.read_csv(StringIO(data), sep='\s+', usecols=('a', 'b'))
1876+
expected = DataFrame({'a': ['apple', 'orange'],
1877+
'b': ['bat', 'cow']}, index=[4, 8])
1878+
1879+
tm.assert_frame_equal(result, expected)
1880+
18711881
def test_pure_python_failover(self):
18721882
data = "a,b,c\n1,2,3#ignore this!\n4,5,6#ignorethistoo"
18731883

0 commit comments

Comments
 (0)