You should pass only the column name in your subset is wrongvariable. Also, try this insteadyour function should return a list with the same length as your column.
def _color_red_or_green(val): conditions = val > 2500 results = [] for v in conditions: if v: color = "red" else: color = "green" results.append(f"color : {color}") return results highlighted=df.style.apply(_color_red_or_green,subset=['cld_hgt'])