Zeya LT
Sep 28, 2022

--

Hi @Raphael Huber,

First of all, I apologise for the late reply! I must have overlooked this note.

Thank you for the interesting question. After some thoughts, I thought one way to achieve what you want in Pandas is to create intermediate/temporary Boolean columns. I have prepared a starter code that explains this at the following GitHub gist:

https://gist.github.com/zeyalt/0dee80ebf332f5fe43e10091f3769bf0#file-highlight_cells_based_on_other_cells-py

If you run the code, you will still have those intemediate columns. Then, exporting the styled DataFrame as an Excel file and removing the unnecessary columns would be a fairly straightforward step.

Of course, your use-case may be more complex than this, but I hope this starter code helps!

--

--

Zeya LT

Data Scientist @ Grab • Former Police Officer • Master’s in Data Science & Analytics • Mid-Career Switcher • Father of Two