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

Pawan G
  • 17
  • 4

1 Answers1

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)
pcampana
  • 2,413
  • 2
  • 21
  • 39