我有下表:
<table border="1">
<tr>
<th scope="col">Header</th>
<th scope="col">Header</th>
<th scope="col">Header</th>
</tr>
<tr>
<th scope="row"> </th>
<td> </td>
<td>Split this one into two columns</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
我希望将包含" 将这一个拆分成两列 "的单元格分成两个单元格/列.我该怎么做?
我有以下生成 HTML 表格的 Python 脚本。现在我想更改表格的某些样式,但是在更改标题的字体大小时遇到了问题。
import pandas as pd
df = pd.DataFrame({'col1': [1, 2, 3, 4]})
html = (df.style
.set_table_styles({'selector': 'th', 'props': [('font-size', '5pt')]})
.set_properties(**{'font-size': '10pt'}).render())
f = open('test.html', 'wb')
f.write(html)
Run Code Online (Sandbox Code Playgroud)
如何更改标题的样式?
import pandas as pd
df = pd.DataFrame({'col1': [1, 2, 3, 4]})
html = (df.style
.set_table_styles({'selector': 'th', 'props': [('font-size', '5pt')]})
.set_properties(**{'font-size': '10pt'}).render())
f = open('test.html', 'wb')
f.write(html)
Run Code Online (Sandbox Code Playgroud)