[英]ImportError: cannot import name Side in `df.to_excel`
While running df.to_excel('Lesson3.xlsx', index=False)
, i am getting the below error, 运行df.to_excel('Lesson3.xlsx', index=False)
时,出现以下错误,
from openpyxl.styles import Side
ImportError: cannot import name Side ImportError:无法导入名称边
I tried below things but all in vane, 我尝试了下面的事情,但是一切都变了,
pip install pandas 点安装熊猫
pip install xlrd
pip3 install --upgrade pandas --force-reinstall
pip3 install --upgrade xlrd --force-reinstall
Below are more details of the error, 以下是该错误的更多详细信息,
Traceback (most recent call last):
File "/home/ubuntu/workspace/Pandas Tutorials/lesson3_write_excel.py", line 40, in <module>
df.to_excel('Lesson3.xlsx', index=False)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 1766, in to_excel
engine=engine)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/excel.py", line 652, in write
freeze_panes=freeze_panes)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/excel.py", line 1404, in write_cells
style_kwargs = self._convert_to_style_kwargs(cell.style)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/excel.py", line 1074, in _convert_to_style_kwargs
new_v = _conv_to_x(v)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/excel.py", line 1310, in _convert_to_border
v = cls._convert_to_side(v)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/excel.py", line 1253, in _convert_to_side
from openpyxl.styles import Side
ImportError: cannot import name Side
您应该安装openpyxl
所使用的df.to_excel()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.