1

I am using panda lib to get dataframe of the excel file. I want to change the background color and save it as the excel file. How Can I do it?

I tried using stylers but it asked me to import Jinja2. I use eclipse IDE and company computer. How to solve it.thanks in advance

1 Answer 1

1

As it is explained here: You can create a function to do the highlighting:

def highlight_cells():
    # provide your criteria for highlighting the cells here
    return ['background-color: yellow']

And then apply your highlighting function to your dataframe:

df.style.apply(highlight_cells)
Sign up to request clarification or add additional context in comments.

1 Comment

Does this change the color when written back to an Excel file?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.