I have a function like this:
def highlight_otls(df):
return ['background-color: yellow']
And a DataFrame like this:
price outlier
1.99 F,C
1.49 L,C
1.99 F
1.39 N
What I want to do is highlight a certain column in my df based off of this condition of another column:
data['outlier'].str.split(',').str.len() >= 2
So if the column values df['outlier'] >= 2, I want to highlight the corresponding column df['price']. (So the first 2 prices should be highlighted in my dataframe above).
I attempted to do this by doing the following which gives me an error:
data['price'].apply(lambda x: highlight_otls(x) if (x['outlier'].str.split(',').str.len()) >= 2, axis=1)
Any idea on how to do this the proper way?

