I want to apply separate background gradient to different columns in my pandas dataframe
a b c
-----
1 2 3
4 5 6
9 2 3
I want one background gradient for column a and a different background gradient to another column as such.
How do I do that?
Thank you very much.
You can apply background_gradient
to each individual column and compose multiple styles in a single call:
df.style\
.background_gradient(cmap="cool", subset=['a'])\
.background_gradient(cmap="bone", subset=['b'])\
.background_gradient(cmap="winter", subset=['c'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With