Pandas style doesn't work with Google colab Pandas style doesn't work with Google colab pandas pandas

Pandas style doesn't work with Google colab


I don't think this is pandas styler. All pandas does is render HTML which works well in Notebook or normal browsers. (Jupyter has its own set of CSS that it applies to rendered tables). Google colab will have their own set of CSS.

I suspect the hierarchy of colab's default CSS is not as dominant as Jupyters. Maybe file an issue with them?


It is the issue with html rendering of Colab but you could try something like this to fix it although it does not give the exact same results as notebook does.

df.style.highlight_max(axis=0).set_properties( **{'width': '30px'},**{'text-align': 'center'})

Output:

center aligned style


It worked for me:

import pandas as pddf = pd.read_csv('/content/drive/My Drive/Colab Notebooks/teste.csv')df.head(100).style.highlight_max(axis=0).set_properties( **{'color': 'red'})

however it does not work with this feature:

%load_ext google.colab.data_table