I have the following python functions for formatting the cells of my dataframe when displayed in a html table:
def style_negative(v, color=''):
return f"color: {color};" if v < 0 else None
display(HTML(df_GDP_Capita_Change
.style.map(style_negative, color='red')
.format('{:,.2%}', na_rep='-')
.set_caption('GDP per capita year change')
.to_html()))
When I apply this function to my dataframe, the output is like expected in my PyCharm IDE, but when I run the Jupyter notebook on the local host the formatting function is not applied to the table cells.
I really cannot figure out why this is and would appreciate if someone could point out why this is and how I could have the formatting also apply to the output on the local host page.
Output in PyCharm:
Output Jupyter local host: