Skip to content
Advertisement

XLWINGS conditional formatting based on value

I have a dataframe in Pandas that I have exported to Excel and formatted headers etc. using XLWINGS. That works like a charm. But I would like to format two columns based on their value in each cell (row), so if the value is above 0 then green and below zero then red.

I can’t seem to find that option using XLWINGS, is that possible somehow?

JavaScript

Advertisement

Answer

You can loop over the cells of the particular columns (note that this might not be successful, if there are empty cells in the particular columns):

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