@@ -303,7 +303,6 @@ def read_excel(io,
303
303
skipfooter = 0 ,
304
304
convert_float = True ,
305
305
** kwds ):
306
- encoding = kwds .get ("encoding" )
307
306
# Can't use _deprecate_kwarg since sheetname=None has a special meaning
308
307
if is_integer (sheet_name ) and sheet_name == 0 and 'sheetname' in kwds :
309
308
warnings .warn ("The `sheetname` keyword is deprecated, use "
@@ -315,7 +314,7 @@ def read_excel(io,
315
314
"`sheet`" )
316
315
317
316
if not isinstance (io , ExcelFile ):
318
- io = ExcelFile (io , engine = engine , encoding = encoding )
317
+ io = ExcelFile (io , engine = engine , ** kwds )
319
318
320
319
return io .parse (
321
320
sheet_name = sheet_name ,
@@ -356,9 +355,8 @@ class ExcelFile(object):
356
355
"""
357
356
358
357
def __init__ (self , io , ** kwds ):
359
-
358
+ kwargs = { 'encoding_override' : kwds . get ( "encoding" )}
360
359
err_msg = "Install xlrd >= 0.9.0 for Excel support"
361
- encoding = kwds .get ("encoding" )
362
360
try :
363
361
import xlrd
364
362
except ImportError :
@@ -400,15 +398,9 @@ def __init__(self, io, **kwds):
400
398
pass
401
399
402
400
data = io .read ()
403
- if encoding :
404
- self .book = xlrd .open_workbook (file_contents = data , encoding_override = encoding )
405
- else :
406
- self .book = xlrd .open_workbook (file_contents = data )
401
+ self .book = xlrd .open_workbook (file_contents = data , ** kwargs )
407
402
elif isinstance (self ._io , compat .string_types ):
408
- if encoding :
409
- self .book = xlrd .open_workbook (self ._io , encoding_override = encoding )
410
- else :
411
- self .book = xlrd .open_workbook (self ._io )
403
+ self .book = xlrd .open_workbook (self ._io , ** kwargs )
412
404
else :
413
405
raise ValueError ('Must explicitly set engine if not passing in'
414
406
' buffer or path for io.' )
0 commit comments