I would like to change the style of my pandas without changing its type
Here a small example
import pandas as pd
df = pd.DataFrame([[19, 439],[19, 439]], columns=['COOL','NOTCOOL'])
def colour_col(col):
if col.name == 'COOL':
return ['background-color: red' for c in col.values]
df = df.style.apply(colour_col)
df
But, obviously df is now a pandas.io.formats.style.Styler, so I can not have access to 'COOL' column anymore
df['COOL']
TypeError: 'Styler' object is not subscriptable
How can I customize my pandas only when it is displayed ?