@@ -167,10 +167,9 @@ def test_parse_cols_int(self):
167167
168168 dfref = self .get_csv_refdf ('test1' )
169169 dfref = dfref .reindex (columns = ['A' , 'B' , 'C' ])
170- df1 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 , parse_dates = True ,
171- parse_cols = 3 )
170+ df1 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 , parse_cols = 3 )
172171 df2 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ], index_col = 0 ,
173- parse_dates = True , parse_cols = 3 )
172+ parse_cols = 3 )
174173 # TODO add index to xls file)
175174 tm .assert_frame_equal (df1 , dfref , check_names = False )
176175 tm .assert_frame_equal (df2 , dfref , check_names = False )
@@ -179,10 +178,9 @@ def test_parse_cols_list(self):
179178
180179 dfref = self .get_csv_refdf ('test1' )
181180 dfref = dfref .reindex (columns = ['B' , 'C' ])
182- df1 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 , parse_dates = True ,
181+ df1 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 ,
183182 parse_cols = [0 , 2 , 3 ])
184183 df2 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ], index_col = 0 ,
185- parse_dates = True ,
186184 parse_cols = [0 , 2 , 3 ])
187185 # TODO add index to xls file)
188186 tm .assert_frame_equal (df1 , dfref , check_names = False )
@@ -193,28 +191,28 @@ def test_parse_cols_str(self):
193191 dfref = self .get_csv_refdf ('test1' )
194192
195193 df1 = dfref .reindex (columns = ['A' , 'B' , 'C' ])
196- df2 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 , parse_dates = True ,
194+ df2 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 ,
197195 parse_cols = 'A:D' )
198196 df3 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ], index_col = 0 ,
199- parse_dates = True , parse_cols = 'A:D' )
197+ parse_cols = 'A:D' )
200198 # TODO add index to xls, read xls ignores index name ?
201199 tm .assert_frame_equal (df2 , df1 , check_names = False )
202200 tm .assert_frame_equal (df3 , df1 , check_names = False )
203201
204202 df1 = dfref .reindex (columns = ['B' , 'C' ])
205- df2 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 , parse_dates = True ,
203+ df2 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 ,
206204 parse_cols = 'A,C,D' )
207205 df3 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ], index_col = 0 ,
208- parse_dates = True , parse_cols = 'A,C,D' )
206+ parse_cols = 'A,C,D' )
209207 # TODO add index to xls file
210208 tm .assert_frame_equal (df2 , df1 , check_names = False )
211209 tm .assert_frame_equal (df3 , df1 , check_names = False )
212210
213211 df1 = dfref .reindex (columns = ['B' , 'C' ])
214- df2 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 , parse_dates = True ,
212+ df2 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 ,
215213 parse_cols = 'A,C:D' )
216214 df3 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ], index_col = 0 ,
217- parse_dates = True , parse_cols = 'A,C:D' )
215+ parse_cols = 'A,C:D' )
218216 tm .assert_frame_equal (df2 , df1 , check_names = False )
219217 tm .assert_frame_equal (df3 , df1 , check_names = False )
220218
@@ -251,23 +249,23 @@ def test_excel_table_sheet_by_index(self):
251249 excel = self .get_excelfile ('test1' )
252250 dfref = self .get_csv_refdf ('test1' )
253251
254- df1 = read_excel (excel , 0 , index_col = 0 , parse_dates = True )
255- df2 = read_excel (excel , 1 , skiprows = [1 ], index_col = 0 , parse_dates = True )
252+ df1 = read_excel (excel , 0 , index_col = 0 )
253+ df2 = read_excel (excel , 1 , skiprows = [1 ], index_col = 0 )
256254 tm .assert_frame_equal (df1 , dfref , check_names = False )
257255 tm .assert_frame_equal (df2 , dfref , check_names = False )
258256
259- df1 = excel .parse (0 , index_col = 0 , parse_dates = True )
260- df2 = excel .parse (1 , skiprows = [1 ], index_col = 0 , parse_dates = True )
257+ df1 = excel .parse (0 , index_col = 0 )
258+ df2 = excel .parse (1 , skiprows = [1 ], index_col = 0 )
261259 tm .assert_frame_equal (df1 , dfref , check_names = False )
262260 tm .assert_frame_equal (df2 , dfref , check_names = False )
263261
264- df3 = read_excel (excel , 0 , index_col = 0 , parse_dates = True , skipfooter = 1 )
265- df4 = read_excel (excel , 0 , index_col = 0 , parse_dates = True , skip_footer = 1 )
262+ df3 = read_excel (excel , 0 , index_col = 0 , skipfooter = 1 )
263+ df4 = read_excel (excel , 0 , index_col = 0 , skip_footer = 1 )
266264 tm .assert_frame_equal (df3 , df1 .ix [:- 1 ])
267265 tm .assert_frame_equal (df3 , df4 )
268266
269- df3 = excel .parse (0 , index_col = 0 , parse_dates = True , skipfooter = 1 )
270- df4 = excel .parse (0 , index_col = 0 , parse_dates = True , skip_footer = 1 )
267+ df3 = excel .parse (0 , index_col = 0 , skipfooter = 1 )
268+ df4 = excel .parse (0 , index_col = 0 , skip_footer = 1 )
271269 tm .assert_frame_equal (df3 , df1 .ix [:- 1 ])
272270 tm .assert_frame_equal (df3 , df4 )
273271
@@ -279,16 +277,15 @@ def test_excel_table(self):
279277
280278 dfref = self .get_csv_refdf ('test1' )
281279
282- df1 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 , parse_dates = True )
283- df2 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ], index_col = 0 ,
284- parse_dates = True )
280+ df1 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 )
281+ df2 = self .get_exceldf ('test1' , 'Sheet2' , skiprows = [1 ], index_col = 0 )
285282 # TODO add index to file
286283 tm .assert_frame_equal (df1 , dfref , check_names = False )
287284 tm .assert_frame_equal (df2 , dfref , check_names = False )
288285
289- df3 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 , parse_dates = True ,
286+ df3 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 ,
290287 skipfooter = 1 )
291- df4 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 , parse_dates = True ,
288+ df4 = self .get_exceldf ('test1' , 'Sheet1' , index_col = 0 ,
292289 skip_footer = 1 )
293290 tm .assert_frame_equal (df3 , df1 .ix [:- 1 ])
294291 tm .assert_frame_equal (df3 , df4 )
@@ -389,7 +386,7 @@ def test_reading_all_sheets_with_blank(self):
389386 basename = 'blank_with_header'
390387 dfs = self .get_exceldf (basename , sheetname = None )
391388 expected_keys = ['Sheet1' , 'Sheet2' , 'Sheet3' ]
392- tm .assert_contains_all (expected_keys , dfs .keys ())
389+ tm .assert_contains_all (expected_keys , dfs .keys ())
393390
394391 # GH6403
395392 def test_read_excel_blank (self ):
@@ -411,14 +408,14 @@ class XlrdTests(ReadingTestsBase):
411408 def test_excel_read_buffer (self ):
412409
413410 pth = os .path .join (self .dirpath , 'test1' + self .ext )
414- expected = read_excel (pth , 'Sheet1' , index_col = 0 , parse_dates = True )
411+ expected = read_excel (pth , 'Sheet1' , index_col = 0 )
415412 with open (pth , 'rb' ) as f :
416- actual = read_excel (f , 'Sheet1' , index_col = 0 , parse_dates = True )
413+ actual = read_excel (f , 'Sheet1' , index_col = 0 )
417414 tm .assert_frame_equal (expected , actual )
418415
419416 with open (pth , 'rb' ) as f :
420417 xls = ExcelFile (f )
421- actual = read_excel (xls , 'Sheet1' , index_col = 0 , parse_dates = True )
418+ actual = read_excel (xls , 'Sheet1' , index_col = 0 )
422419 tm .assert_frame_equal (expected , actual )
423420
424421 def test_read_xlrd_Book (self ):
@@ -680,7 +677,7 @@ def test_excel_oldindex_format(self):
680677 tm .assert_frame_equal (actual , expected , check_names = False )
681678
682679 def test_read_excel_bool_header_arg (self ):
683- #GH 6114
680+ # GH 6114
684681 for arg in [True , False ]:
685682 with tm .assertRaises (TypeError ):
686683 pd .read_excel (os .path .join (self .dirpath , 'test1' + self .ext ),
@@ -692,6 +689,19 @@ def test_read_excel_chunksize(self):
692689 pd .read_excel (os .path .join (self .dirpath , 'test1' + self .ext ),
693690 chunksize = 100 )
694691
692+ def test_read_excel_parse_dates (self ):
693+ # GH 11544
694+ with tm .assertRaises (NotImplementedError ):
695+ pd .read_excel (os .path .join (self .dirpath , 'test1' + self .ext ),
696+ parse_dates = True )
697+
698+ def test_read_excel_date_parser (self ):
699+ # GH 11544
700+ with tm .assertRaises (NotImplementedError ):
701+ dateparse = lambda x : pd .datetime .strptime (x , '%Y-%m-%d %H:%M:%S' )
702+ pd .read_excel (os .path .join (self .dirpath , 'test1' + self .ext ),
703+ date_parser = dateparse )
704+
695705 def test_read_excel_skiprows_list (self ):
696706 #GH 4903
697707 actual = pd .read_excel (os .path .join (self .dirpath , 'testskiprows' + self .ext ),
@@ -1093,7 +1103,7 @@ def test_to_excel_periodindex(self):
10931103 xp .to_excel (path , 'sht1' )
10941104
10951105 reader = ExcelFile (path )
1096- rs = read_excel (reader , 'sht1' , index_col = 0 , parse_dates = True )
1106+ rs = read_excel (reader , 'sht1' , index_col = 0 )
10971107 tm .assert_frame_equal (xp , rs .to_period ('M' ))
10981108
10991109 def test_to_excel_multiindex (self ):
0 commit comments