Colouring one column of pandas dataframe
You can solve it in one line like this:
df.style.set_properties(**{'background-color': 'red'}, subset=['A'])
where subset is the list of column names on which you want to apply the desired properties.
The result is the same as shown by @jezrael You can check other properties and possibilities for styling in pandas' website
I think you need custom function which return DataFrame
with color for first column:
np.random.seed(100)
df = pd.DataFrame(np.random.randn(5, 3), columns=list('ABC'))
def highlight_col(x):
r = 'background-color: red'
df1 = pd.DataFrame('', index=x.index, columns=x.columns)
df1.iloc[:, 0] = r
return df1
df.style.apply(highlight_col, axis=None)