我正在尝试运行我的脚本数据块 using 数据框_图像库来设置我的表格样式,然后将其另存为 .png 文件并收到错误OsError:无法在您的计算机上找到 Chrome 可执行文件。
Per 文档 https://pypi.org/project/dataframe-image/我需要添加 table_conversion = 'matplotlib'
import pandas as pd
import numpy as np
np.random.seed(0)
df = pd.DataFrame(np.random.randn(10,4), columns=['A','B','C','D'])
def highlight_max(s, props=''):
return np.where(s == np.nanmax(s.values), props, '')
styled_table = df.style.apply(highlight_max, props='color:red;', axis=1)\
.set_properties(**{'background-color': '#ffffb3'})
import dataframe_image as dfi # you might need to pip install dataframe-image
dfi.export(styled_table, 'file1.png', table_conversion = 'matplotlib')
结果,所有样式都丢失了。
注意:当我使用 table_conversion = 'chrome' 在 Jupyter 中运行相同的脚本时,一切正常。
我想知道是否有解决方法。欢迎任何建议。谢谢。
对于基于 Debian 的操作系统:
apt install chromium-chromedriver
为我解决了。
Chrome 可执行错误#6 https://github.com/dexplo/dataframe_image/issues/6
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)