79470589

Date: 2025-02-26 17:34:48
Score: 0.5
Natty:
Report link

Apparently I didn't read enough of the documentation. You can give applymap any kwargs used by the formatting function:

def condFormat(s, dic=None):
    dcolors = {"GREEN": "rgb(146, 208, 80)",
               "YELLOW": "rgb(255, 255, 153)",
               "RED": "rgb(218, 150, 148)",
               None: "rgb(255, 255, 255)"}
    return f'background-color: {dcolors.get(dic.get(s), "")}'

dic = dfdefs.set_index('STATUS')['COLOR'].to_dict()
dfhealth.style.applymap(condFormat, dic=dic)
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Kes Perron