I want to style my table with Pandas with the following example from this site: https://pandas.pydata.org/pandas-docs/stable/user_guide/style.html
Now, the problem is, that I use Pycharm. So after executed my code, the table creates its own colors based on the values. But this is not what I am looking for. Does anyone have the same problem with Pycharm?
import pandas as pd
import numpy as np
np.random.seed(24)
df = pd.DataFrame({'A': np.linspace(1, 10, 10)})
df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))],
axis=1)
df.iloc[0, 2] = np.nan
def color_negative_red(val):
"""
Takes a scalar and returns a string with
the css property `'color: red'` for negative
strings, black otherwise.
"""
color = 'red' if val < 0 else 'black'
return 'color: %s' % color
s = df.style.applymap(color_negative_red)