Explore or highlight your data by changing the format of specific cells.
Conditional formatting makes it easy to highlight certain values or make particular cells easy to identify. It changes the appearance of a cell based on a condition. You can use conditional formatting to highlight cells that contain values which meet a certain condition.
- 1.Click Format and then Conditional Formatting.
- 2.Click Add Conditional Formatting Rule.
- 3.Click on the newly added rule to configure it:
- 1.Select the Columns to apply the conditional format within.
- 2.Select the filter condition Where the conditional format should apply.
- 3.Set the Text Color and Background Color to apply to the cells identified by this condition.
A conditional format being applied to the column X to highlight values over 7.
Conditional formatting rules will be applied in-order, with later conditional formatting rules overwriting earlier ones. For example:
- 1.First conditional format sets cells >= 7 to have a red background color.
- 2.Second conditional format sets cells >= 8 to have a blue background color.
All cells equal to 7 will have a red background. All cells >= 8 will have a blue background color, as this rule is later, and so will overwrite the first conditional format.
Not all conditions can be applied to all columns. For example, if you are adding a conditional format to a number column, but you use the string starts with condition to select cells, this will error.
If the conditional formatting rule cannot be applied, it will display an error message prompting you to update the filter condition.
To view the dataframe with conditional formats in your notebook, simply display the styling object generated by Mito:
The styling code generated by Mito, plus a line of code that displays the styled object.