Jul-20-2023, 12:16 PM
Hmm..I faced the issue, after couple of testing where, if I have TEXT B, it'll color RED and it doesn't color TEXT A even if the TEXT is present in the table.
TEXT B ( cell: RED ) TEXT B ( cell: RED ) TEXT A ( fails to color green )Further, I even tried, but when I try to import the table as HTML for e-mail body, it gives out AttributeError: 'str' object has no attribute 'style'
def color(value): if value == 'TEXT B': color = 'red' elif value == 'TEXT A': color = 'green' return 'background-color: %s' % color df.style.applymap(color, subset=['Col3'])I would need help, where if the table col has TEXT B color red and TEXT A color green.
#html = html.replace("\">TEXT A", "; background-color: #7CFC00\">TEXT A") #html = html.replace("\">TEXT B", "; background-color: #Ff0000\">TEXT B")