@@ -836,7 +836,7 @@ def test_integer_overflow_bug(self):
836
836
result = self .read_csv (StringIO (data ), header = None , sep = ' ' )
837
837
self .assertTrue (result [0 ].dtype == np .float64 )
838
838
839
- result = self .read_csv (StringIO (data ), header = None , sep = '\s+' )
839
+ result = self .read_csv (StringIO (data ), header = None , sep = r '\s+' )
840
840
self .assertTrue (result [0 ].dtype == np .float64 )
841
841
842
842
def test_catch_too_many_names (self ):
@@ -852,7 +852,7 @@ def test_catch_too_many_names(self):
852
852
def test_ignore_leading_whitespace (self ):
853
853
# see gh-3374, gh-6607
854
854
data = ' a b c\n 1 2 3\n 4 5 6\n 7 8 9'
855
- result = self .read_table (StringIO (data ), sep = '\s+' )
855
+ result = self .read_table (StringIO (data ), sep = r '\s+' )
856
856
expected = DataFrame ({'a' : [1 , 4 , 7 ], 'b' : [2 , 5 , 8 ], 'c' : [3 , 6 , 9 ]})
857
857
tm .assert_frame_equal (result , expected )
858
858
@@ -1052,7 +1052,7 @@ def test_uneven_lines_with_usecols(self):
1052
1052
1053
1053
# make sure that an error is still thrown
1054
1054
# when the 'usecols' parameter is not provided
1055
- msg = "Expected \d+ fields in line \d+, saw \d+"
1055
+ msg = r "Expected \d+ fields in line \d+, saw \d+"
1056
1056
with tm .assertRaisesRegexp (ValueError , msg ):
1057
1057
df = self .read_csv (StringIO (csv ))
1058
1058
@@ -1122,7 +1122,7 @@ def test_raise_on_sep_with_delim_whitespace(self):
1122
1122
# see gh-6607
1123
1123
data = 'a b c\n 1 2 3'
1124
1124
with tm .assertRaisesRegexp (ValueError , 'you can only specify one' ):
1125
- self .read_table (StringIO (data ), sep = '\s' , delim_whitespace = True )
1125
+ self .read_table (StringIO (data ), sep = r '\s' , delim_whitespace = True )
1126
1126
1127
1127
def test_single_char_leading_whitespace (self ):
1128
1128
# see gh-9710
@@ -1157,7 +1157,7 @@ def test_empty_lines(self):
1157
1157
[- 70. , .4 , 1. ]])
1158
1158
df = self .read_csv (StringIO (data ))
1159
1159
tm .assert_numpy_array_equal (df .values , expected )
1160
- df = self .read_csv (StringIO (data .replace (',' , ' ' )), sep = '\s+' )
1160
+ df = self .read_csv (StringIO (data .replace (',' , ' ' )), sep = r '\s+' )
1161
1161
tm .assert_numpy_array_equal (df .values , expected )
1162
1162
expected = np .array ([[1. , 2. , 4. ],
1163
1163
[np .nan , np .nan , np .nan ],
@@ -1189,14 +1189,14 @@ def test_regex_separator(self):
1189
1189
b 1 2 3 4
1190
1190
c 1 2 3 4
1191
1191
"""
1192
- df = self .read_table (StringIO (data ), sep = '\s+' )
1192
+ df = self .read_table (StringIO (data ), sep = r '\s+' )
1193
1193
expected = self .read_csv (StringIO (re .sub ('[ ]+' , ',' , data )),
1194
1194
index_col = 0 )
1195
1195
self .assertIsNone (expected .index .name )
1196
1196
tm .assert_frame_equal (df , expected )
1197
1197
1198
1198
data = ' a b c\n 1 2 3 \n 4 5 6\n 7 8 9'
1199
- result = self .read_table (StringIO (data ), sep = '\s+' )
1199
+ result = self .read_table (StringIO (data ), sep = r '\s+' )
1200
1200
expected = DataFrame ([[1 , 2 , 3 ], [4 , 5 , 6 ], [7 , 8 , 9 ]],
1201
1201
columns = ['a' , 'b' , 'c' ])
1202
1202
tm .assert_frame_equal (result , expected )
@@ -1580,7 +1580,7 @@ def test_temporary_file(self):
1580
1580
new_file .flush ()
1581
1581
new_file .seek (0 )
1582
1582
1583
- result = self .read_csv (new_file , sep = '\s+' , header = None )
1583
+ result = self .read_csv (new_file , sep = r '\s+' , header = None )
1584
1584
new_file .close ()
1585
1585
expected = DataFrame ([[0 , 0 ]])
1586
1586
tm .assert_frame_equal (result , expected )
0 commit comments