I created a DataFrame in pandas for which I want to color the cells using a color index (low values red, high values green). I succeeded in doing so, however the coloring prevents me to format the cells.
import pandas as pd
df = pd.DataFrame({'a': [0.5,1.5, 5],
'b': [2, 3.5, 7] })
df = df.style.background_gradient(cmap='RdYlGn')
df
which returns
However, when I try to use df.round(2)
for example to format the numbers, the following error pops up:
AttributeError: 'Styler' object has no attribute 'round'