Fill Pattern
I would like my output excel file to have colors. But I need help with my python code that will color the cells. Something like:
If "Strong", then color the cells Green
If "Satisfactory", then color the cells Yellow
Then I need to connect the If statement to the Pattern Fill code:
Fill_Pattern = PatternFill(patterntype='solid', fgcolor='00B050')
ws[insert appropriate columns].fill = fill_pattern
Best Answer
-
tgb417 Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Dataiku Frontrunner Awards 2021 Participant, Frontrunner 2022 Participant, Neuron 2023 Posts: 1,601 Neuron
I've not done this before.
However, this might be interesting.
https://www.youtube.com/watch?v=ZXjHAxHyi9k
In Dataiku DSS we can of course use Jupyter Notebooks.
The interesting part here is the use of the engine openpyxl when Saving to move Pandas Dataframe formating into the resulting MS Excel file.https://openpyxl.readthedocs.io/en/stable/formatting.html
Let us know how you get on with this.
Answers
-
tgb417 Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Dataiku Frontrunner Awards 2021 Participant, Frontrunner 2022 Participant, Neuron 2023 Posts: 1,601 Neuron
Sounds like an interesting challenge. It will likely be strongly dependent on the Python library you are choosing to work with. What Python library are you using/ importing that has those capabilities?
-
- Hi Tom, sorry for the late reply. We are just using the excel library. Uploading an excel document into Dataiku, and then I need to create the Python code, so that the output file will color certain cells based on the values in those cells. Ie: all "Strong" should be color coded green
-
Thank you will do!
-
U can try this.