Skip to content

Commit

Permalink
ASV: Added seek to buffer to fix xlwt asv failure (pandas-dev#19926)
Browse files Browse the repository at this point in the history
* Added seek to buffer to fix xlwt asv failure

* Added conditional to check for seek on xlrd object
  • Loading branch information
WillAyd authored and harisbal committed Feb 28, 2018
1 parent 2d10b35 commit 892dd3d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pandas/io/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ def __init__(self, io, **kwds):
self.book = io
elif not isinstance(io, xlrd.Book) and hasattr(io, "read"):
# N.B. xlrd.Book has a read attribute too
if hasattr(io, 'seek'):
# GH 19779
io.seek(0)

data = io.read()
self.book = xlrd.open_workbook(file_contents=data)
elif isinstance(self._io, compat.string_types):
Expand Down

0 comments on commit 892dd3d

Please sign in to comment.