如何将pandas dataframe中的边框添加到html表的行标题中?

2024-04-28 17:35:23 发布

您现在位置:Python中文网/ 问答频道 /正文

Pandas样式选项允许我格式化数据,但我想在列标题(即第0行)中添加边框。在

htmlFooterOutdatedList = dfServerOutdated[['System Name','IP Address','Last Communication','DAT (VSE)','OS Type','Status']].style.hide_index().set_properties(**{'font-size': '10pt','background-color': '#edeeef','border-color': 'black','border-style' :'solid' ,'border-width': '1px','border-collapse':'collapse', 'padding': '5px'}).applymap(datversion,subset = 'DAT (VSE)').applymap(LTSCDate,subset = 'Last Communication').background_gradient(cmap='PuBu', low=0, high=0, axis=0, subset='DAT (VSE)', text_color_threshold=0.458).set_table_styles([{'selector': 'th', 'props': [('font-size', '12pt')]}]).set_properties(subset=['Last Communication'], **{'width': '180px'}).set_properties(subset=['System Name'], **{'width': '30px'}).set_properties(subset=['Status'], **{'width': '90px'}).render()

Whi the rows are formatted, the column header border is missing which I want to add.

我可以为列标题添加边框吗?在


Tags: name标题statuspropertieswidthsystemdatcolor