我有一堆xlsx文件,其工作表名为None
(空字符串)
当我试图使用pandas
读取文件时,xlrd
会产生一个list index out of range
错误。
Traceback (most recent call last):
File "/usr/local/bin/runxlrd.py", line 332, in main
ragged_rows=options.ragged_rows,
File "/Library/Python/2.7/site-packages/xlrd/__init__.py", line 416, in open_workbook
ragged_rows=ragged_rows,
File "/Library/Python/2.7/site-packages/xlrd/xlsx.py", line 791, in open_workbook_2007_xml
x12sheet.process_stream(zflo, heading)
File "/Library/Python/2.7/site-packages/xlrd/xlsx.py", line 528, in own_process_stream
self_do_row(elem)
File "/Library/Python/2.7/site-packages/xlrd/xlsx.py", line 667, in do_row
value = self.sst[int(tvalue)]
IndexError: list index out of range
我在xrld
github中发现了this问题,我认为这是相关的。
如果更改工作表的名称,pandas
将成功读取文件。
例如,我无法共享这些文件(隐私问题),当我试图创建一个以None
为工作表名的演示文件时,Excel引发了一个无效名称错误。在
软件包版本。在
^{pr2}$有没有一种方法可以用pandas或脚本(任何语言)来读取这个文件来更改工作表名称?在
对于我来说,使用python2.7、pandas 0.23.3和xlrd 1.1.0就可以了
相关问题 更多 >
编程相关推荐