Example: Pandas Excel output with conditional formatting ...
xlsxwriter.readthedocs.io › example_pandasExcelWriter ('pandas_conditional.xlsx', engine = 'xlsxwriter') # Convert the dataframe to an XlsxWriter Excel object. df. to_excel (writer, sheet_name = 'Sheet1') # Get the xlsxwriter workbook and worksheet objects. workbook = writer. book worksheet = writer. sheets ['Sheet1'] # Apply a conditional format to the cell range. worksheet. conditional_format ('B2:B8', {'type': '3_color_scale'}) # Close the Pandas Excel writer and output the Excel file. writer. save ()