我正在使用Pycharm,我试图弄清楚如何在Pandas中显示样式?我以以下网站为例:https://towardsdatascience.com/10-python-pandas-tricks-to-make-data-analysis-more-enjoyable-cb8f55af8c30
这里缺少什么?
import pandas as pd
def color_negative_red(val):
color = 'red' if val < 0 else 'black'
return 'color: %s' % color
df = pd.DataFrame(dict(col_1=[1.53,-2.5,3.53], col_2=[-4.1,5.9,0]))
df.style.applymap(color_negative_red)
print(df)