我将如何更改背景颜色而不是字体颜色?
def cloud_height_style_function(vals):
return pd.cut(vals,[-np.inf,199,499,999,3000, np.inf], # need to review the bin a bit
labels=[f'color: {c}' for c in ['#9400D3','#FFA500','#FF0000','#FFFF00','#00b050']])
如果我将标签更改为
labels=['background-color: %s' for c in ['#9400D3','#FFA500','#FF0000','#FFFF00','#00b050']])
它给了我ValueError :(“类别必须是唯一的”,“发生在索引cld_hgt上”
这是我要使用的数据框
icao msg_type time dt ddd ff gg flt_cat vis cld_hgt cld_type present_wx vis_obc
0 KLAX ROUTINE 2019-10-14 00:53 1:00 260 10 -9999 VFR 10.0 9999 9999 None -9999
1 KLAX ROUTINE 2019-10-14 01:53 1:00 240 9 -9999 VFR 10.0 9999 9999 None -9999
2 KLAX ROUTINE 2019-10-14 02:53 1:00 260 6 -9999 VFR 10.0 9999 9999 None -9999
3 KLAX ROUTINE 2019-10-14 03:53 1:00 250 5 -9999 VFR 10.0 9999 9999 None -9999
4 KLAX ROUTINE 2019-10-14 04:53 1:00 240 4 -9999 VFR 10.0 9999 9999 None -9999
5 KLAX ROUTINE 2019-10-14 05:53 1:00 250 5 -9999 VFR 10.0 9999 9999 None -9999