I would like to have all numbers rounded to two decimal places in my pandas table which I'm looking to visualise. When I do df.round(2)
I get the desired output:
However, when I then apply a conditional styling to this table, I end up with trailing zeros.
df.round(2).style.apply(lambda x: ['background: cyan' if 1>x['target'] else 'background: yellow' for v in x], axis=1)
Any ideas how I can get rid of the trailing zeros while applying the conditional background style? Thanks in advance.