You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using pandas 0.13.1 on OS X Mavericks to parse a blank Excel spreadsheet causes "IndexError: list index out of range". Apparently the default header=0 in _parse_excel causes the execution of _trim_excel_header(data[header]). Perhaps when nrows==0 this should not be executed.
importpandasaspdxl_file=pd.ExcelFile('blank.xlsx')
xl_file.parse('Sheet1') #Sheet1 has no data
STDERR:
Traceback (most recent call last):
File "/Users/myourshaw/lab/pypeline/python2/excel_example.py", line 10, in <module>
xl_file.parse('Sheet1')
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/io/excel.py", line 208, in parse
**kwds)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/io/excel.py", line 291, in _parse_excel
data[header] = _trim_excel_header(data[header])
IndexError: list index out of range
The text was updated successfully, but these errors were encountered:
FYI ... I still get an error if I bypass "_trim_excel_header(data[header])". I'm able to get around the problem if I return out of _parse_excel() when no rows are detected.
...
if isinstance(sheetname, compat.string_types):
sheet = self.book.sheet_by_name(sheetname)
else: # assume an integer if not a string
sheet = self.book.sheet_by_index(sheetname)
if not sheet.nrows:
return
data = []
should_parse = {}
...
The terminal output looks like this ...
import pandas as pd
xl_file=pd.ExcelFile('blank.xlsx')
xl_file.parse('Sheet1')
Add support for StringIO/BytesIO to ExcelWriter
Add vbench support for writing excel files
Add support for serializing lists/dicts to strings
Fix bug when reading blank excel sheets
Added xlwt to Python 3.4 builds
closespandas-dev#8188closespandas-dev#7074closespandas-dev#6403closespandas-dev#7171closespandas-dev#6947
Using pandas 0.13.1 on OS X Mavericks to parse a blank Excel spreadsheet causes "IndexError: list index out of range". Apparently the default header=0 in
_parse_excel
causes the execution of_trim_excel_header(data[header])
. Perhaps when nrows==0 this should not be executed.STDERR:
The text was updated successfully, but these errors were encountered: