我不确定我们是否有同样的问题,但我的问题是使用.style.render()
. 我尝试使用 CSS 样式,但它不起作用。我使用的解决方案很简单,我没有考虑,我基本上运行.hide_index()
,像这样:
html = ts_volume_html.style.format({'total_ops': "{:.2f}", 'read_ops': '{:.2f}','read_data(bps)':'{:.2f}',
'read_latency(us)': "{:.2f}", 'write_ops': '{:.2f}','write_data(bps)':'{:.2f}',
'write_latency(us)': "{:.2f}", 'other_ops': '{:.2f}','other_latency(us)':'{:.2f}', \
.set_table_attributes('border="1" class="dataframe table table-hover table-bordered"')\
.set_precision(2).set_properties(**{'font-size': '10pt', 'font-family': 'Courier New'})\
.hide_index().background_gradient(cmap=cm).set_table_styles([{'selector': 'th', 'props': [('font-size', '10pt')]}]).render()
然后我将 'html' str 保存到一个 html 文件中。