我正在尝试阅读excel工作表(xlsx),它使用背景色来区分值。
我尝试了以下库:
-
熊猫没有找到任何选项来读取基于背景色的单元格。
-
xlrd。
import xlrd
xlrd.open_workbook("filename.xlsx", formatting_info=True)
它给出的错误如下:
NotImplementedError:formatting\u info=True尚未实现。
-
StyleFrame(正如DeepSpace在《基于excel工作表中的单元格颜色和文本颜色对数据框进行子集设置》中所建议的
)
from StyleFrame import StyleFrame, utils
sf = StyleFrame.read_excel('filename.xlsx', read_style=True, use_openpyxl_styles=False)
它给出的错误如下:
Traceback (most recent call last):
File "proj_path/read_excel.py", line 22, in <module>
sf = StyleFrame.read_excel('filename.xlsx', read_style=True, use_openpyxl_styles=False)
File "C:\Anaconda\lib\site-packages\StyleFrame\deprecations.py", line 22, in inner
return func(*args, **kwargs)
File "C:\Anaconda\lib\site-packages\StyleFrame\style_frame.py", line 220, in read_excel
_read_style()
File "C:\Anaconda\lib\site-packages\StyleFrame\style_frame.py", line 209, in _read_style
read_comments and current_cell.comment)
File "C:\Anaconda\lib\site-packages\StyleFrame\styler.py", line 127, in from_openpyxl_style
font_color = theme_colors[openpyxl_style.font.color.theme]
TypeError: list indices must be integers or slices, not Integer
任何帮助我朝着正确方向发展的建议都将不胜感激。