小编Fin*_*und的帖子

pandas DataFrame to_html 中的粗体列

我试图用一个粗体列返回 df.to_html() 。我只尝试过

df = pd.DataFrame({'important_column': [1,2,3,4], 
                   'dummy_column': [5,6,7,8]})

def some_function()
      df.apply(lambda x: '<b>' + str(df['important_column']) + '</b>', axis=1)
      return [df.to_html()]
Run Code Online (Sandbox Code Playgroud)

但这似乎不起作用。有人知道实用的解决方案吗?

html python pandas

5
推荐指数
2
解决办法
1万
查看次数

标签 统计

html ×1

pandas ×1

python ×1