Skip to content
Advertisement

Color in cell containing a string Pandas

i am trying to change the background color in my dataframe if a column contains a certain string however i cant seem to get it to work. I have the following code so far:

JavaScript

but it doesn’t seem to do anything to the cells. Is there anything i am doing wrong?

Code:

JavaScript

Advertisement

Answer

You can use custom function for create DataFrame of styles:

JavaScript

Another solution is slect columns for test values by in:

JavaScript

EDIT: In your solution need assign back:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement