【发布时间】:2017-09-24 17:22:27
【问题描述】:
我有一个数据框,下面是我的颜色代码:
def color (val):
if final.iloc[1,1]<final.iloc[1,0]:
return "background-color: green"
else:
return "background-color: red"
我希望只返回 final.iloc[1,1] 以具有绿色背景,如果应用上述代码,我的整个数据框已经变为绿色。
我也希望final.iloc[1,1] 能够更改字体样式,有人可以分享我的想法吗?
【问题讨论】:
-
这可能会有所帮助....stackoverflow.com/q/38511373/6524169
-
不能,我已经尝试过了,但就我而言,我只需要一个单元格而不是整个数据框
-
我已经更新了我的帖子。