I have a df that looks like this:
date1 date2 date3
Taco 24 13 28
Pizza 1 3 15
Burger 12 2 27
and have defined the following function:
def _color_red_or_green(val):
color = 'red' if val < 10 else 'green'
return 'color: %s' % color
When I try to execute the function on the df, I get this:
In: s = df.style.applymap(_color_red_or_green)
In: s
Out: <pandas.formats.style.Styler at 0x2a18fabdc50>
Also, s does not appear as a variable in the explorer (using Spyder). What's going on here?
The styler object can't be rendered in spyder's ipython console. Maybe you want to run that in jupyter notebook, then it will be rendered as you wanted.
As for the variable explorer, click the gear icon of variable explorer, and disselect "exclude unsupported data types", then you should see s