【发布时间】:2019-11-07 09:46:17
【问题描述】:
我正在使用 imgkit 创建一个 pdf,其中包含从来自数据框的 html 创建的图像。我需要将整个特定行加粗 [rows: 0 and 7] 但还没有实现。我错过了什么?
html = df.style\
.set_properties(**{'width': 200, 'background-color': '#eae2d5',
'color': 'black', 'font-size': '14px',
'text-align': 'left'},
subset=['var1'])\
.set_properties(**{'color': '\033[1m'}, # BOLDING rows 1
subset=['var1'][0])\ # Here is the error. .
.set_properties(**{'color': '\033[1m'}, # BOLDING rows 7
subset=['var1'][7])\ # Here is the error.
.set_properties(**{'width': 80, 'background-color': '#eae2d5',
'color': 'black', 'font-size': '14px',
'text-align': 'center'},
subset=['var3', 'var4'])\
.set_table_styles([{'selector': 'thead',
'props': [('background-color', '#b2361e'),
('color', 'white'),
('font-size', '18px')]}, ])\
.highlight_null(null_color='white').hide_index().render()
到目前为止它说:“SyntaxError:行继续字符后的意外字符”
【问题讨论】:
标签: python