@@ -158,56 +158,74 @@ def setup_method(self, method):
158
158
self .check_skip ()
159
159
super (ReadingTestsBase , self ).setup_method (method )
160
160
161
- def test_parse_cols_int (self ):
161
+ def test_usecols_int (self ):
162
162
163
163
dfref = self .get_csv_refdf ('test1' )
164
164
dfref = dfref .reindex (columns = ['A' , 'B' , 'C' ])
165
- df1 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 , parse_cols = 3 )
165
+ df1 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 , usecols = 3 )
166
166
df2 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ], index_col = 0 ,
167
- parse_cols = 3 )
167
+ usecols = 3 )
168
+
169
+ with tm .assert_produces_warning (FutureWarning ):
170
+ df3 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ],
171
+ index_col = 0 , parse_cols = 3 )
172
+
168
173
# TODO add index to xls file)
169
174
tm .assert_frame_equal (df1 , dfref , check_names = False )
170
175
tm .assert_frame_equal (df2 , dfref , check_names = False )
176
+ tm .assert_frame_equal (df3 , dfref , check_names = False )
171
177
172
- def test_parse_cols_list (self ):
178
+ def test_usecols_list (self ):
173
179
174
180
dfref = self .get_csv_refdf ('test1' )
175
181
dfref = dfref .reindex (columns = ['B' , 'C' ])
176
182
df1 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 ,
177
- parse_cols = [0 , 2 , 3 ])
183
+ usecols = [0 , 2 , 3 ])
178
184
df2 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ], index_col = 0 ,
179
- parse_cols = [0 , 2 , 3 ])
185
+ usecols = [0 , 2 , 3 ])
186
+
187
+ with tm .assert_produces_warning (FutureWarning ):
188
+ df3 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ],
189
+ index_col = 0 , parse_cols = [0 , 2 , 3 ])
190
+
180
191
# TODO add index to xls file)
181
192
tm .assert_frame_equal (df1 , dfref , check_names = False )
182
193
tm .assert_frame_equal (df2 , dfref , check_names = False )
194
+ tm .assert_frame_equal (df3 , dfref , check_names = False )
183
195
184
- def test_parse_cols_str (self ):
196
+ def test_usecols_str (self ):
185
197
186
198
dfref = self .get_csv_refdf ('test1' )
187
199
188
200
df1 = dfref .reindex (columns = ['A' , 'B' , 'C' ])
189
201
df2 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 ,
190
- parse_cols = 'A:D' )
202
+ usecols = 'A:D' )
191
203
df3 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ], index_col = 0 ,
192
- parse_cols = 'A:D' )
204
+ usecols = 'A:D' )
205
+
206
+ with tm .assert_produces_warning (FutureWarning ):
207
+ df4 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ],
208
+ index_col = 0 , parse_cols = 'A:D' )
209
+
193
210
# TODO add index to xls, read xls ignores index name ?
194
211
tm .assert_frame_equal (df2 , df1 , check_names = False )
195
212
tm .assert_frame_equal (df3 , df1 , check_names = False )
213
+ tm .assert_frame_equal (df4 , df1 , check_names = False )
196
214
197
215
df1 = dfref .reindex (columns = ['B' , 'C' ])
198
216
df2 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 ,
199
- parse_cols = 'A,C,D' )
217
+ usecols = 'A,C,D' )
200
218
df3 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ], index_col = 0 ,
201
- parse_cols = 'A,C,D' )
219
+ usecols = 'A,C,D' )
202
220
# TODO add index to xls file
203
221
tm .assert_frame_equal (df2 , df1 , check_names = False )
204
222
tm .assert_frame_equal (df3 , df1 , check_names = False )
205
223
206
224
df1 = dfref .reindex (columns = ['B' , 'C' ])
207
225
df2 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 ,
208
- parse_cols = 'A,C:D' )
226
+ usecols = 'A,C:D' )
209
227
df3 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ], index_col = 0 ,
210
- parse_cols = 'A,C:D' )
228
+ usecols = 'A,C:D' )
211
229
tm .assert_frame_equal (df2 , df1 , check_names = False )
212
230
tm .assert_frame_equal (df3 , df1 , check_names = False )
213
231
@@ -457,14 +475,14 @@ def test_read_one_empty_col_no_header(self):
457
475
actual_header_none = read_excel (
458
476
path ,
459
477
'no_header' ,
460
- parse_cols = [0 ],
478
+ usecols = [0 ],
461
479
header = None
462
480
)
463
481
464
482
actual_header_zero = read_excel (
465
483
path ,
466
484
'no_header' ,
467
- parse_cols = [0 ],
485
+ usecols = [0 ],
468
486
header = 0
469
487
)
470
488
expected = DataFrame ()
@@ -486,14 +504,14 @@ def test_read_one_empty_col_with_header(self):
486
504
actual_header_none = read_excel (
487
505
path ,
488
506
'with_header' ,
489
- parse_cols = [0 ],
507
+ usecols = [0 ],
490
508
header = None
491
509
)
492
510
493
511
actual_header_zero = read_excel (
494
512
path ,
495
513
'with_header' ,
496
- parse_cols = [0 ],
514
+ usecols = [0 ],
497
515
header = 0
498
516
)
499
517
expected_header_none = DataFrame (pd .Series ([0 ], dtype = 'int64' ))
0 commit comments