我有一個如下所示的數據框架
test_id,status,revenue,cnt_days,age
1,passed,234.54,3,21
2,passed,543.21,5,29
11,failed,21.3,4,35
15,failed,2098.21,6,57
51,passed,232,21,80
75,failed,123.87,32,43
df1 = pd.read_clipboard(sep=',')
我想在revenue is greater than 500
時給行上色。所以,我用了這里找到的pretty_html_table
因此,我嘗試使用conditions
參數執行以下操作,但沒有成功
build_table(data,'blue_light', font_size='8px',font_family='Open Sans,sans-serif',
text_align='center',width='70px',index=False, conditions={'Revenue': {'max':500,'max_color': 'red'}},even_color='black',even_bg_color='white')
但這并沒有對列應用任何顏色。
我如何使用這個來應用顏色,這樣我就可以在我的郵件正文中使用這個html table
?
我希望我的輸出如下,列標題為黃色,收入>500行為紅色
你可以試試
.style.apply
和.set_table_styles