我一直在尝试将 Pandas 数据框打印到 html 并突出显示特定的整行,如果该行的一个特定列的值超过阈值。我查看了 Pandas Styler Slicing 并尝试更改 highlight_max 函数以用于此类用途,但似乎失败得很惨;例如,如果我尝试用检查给定行的值是否高于所述阈值来替换 is_max (例如,类似于
is_x = df['column_name'] >= threshold
),目前尚不清楚如何正确传递这样的事情或返回什么。
我也尝试过使用 df.loc 在其他地方简单地定义它,但这也不是很好。
另一个问题也出现了:如果我之后删除该列(目前是标准),样式还会保留吗?我想知道 df.loc 是否会阻止这样的事情成为问题。