I have the following dataframe and want to convert it to HTML
            Limit        Status     Warning      3M AVG
VAR1        1.20         1.21216    1.11         1.21235
VAR2        0.82         0.63075    0.75         0.593295
VAR3        0.38         0.376988   0.35         0.376988
VAR4        0.17         0.126987   0.14         0.12461
I want to format this dataframe row-wise such that:
- If StatusexceedsWarningthe whole row becomes highlighted yellow and if it exceedsLimitthe whole row becomes highlighted red
- row VAR2andVAR3have "{:.2%}" format andVAR1andVAR4have "{:.2f}"
I've dug into pandas documentation and tried a couple of methods but I couldn't do all of the above tasks
I would appreciate if you could help since I believe it's a challenge for many pandas users to format a dataframe row wise.
Edit 1: I have tried the following code:
df=df.transpose()    
df.style.format("{:.2%}").format({"VAR1":"{:.2f},"VAR4":"{:.2f}"})
Note: by transposing the dataframe it is much easier to do all tasks but I cannot transpose it back to its original shape because it is styler.
 
     
    
 
    