Member-only story
A Quick and Easy Guide to Conditional Formatting in Pandas
Discover how you can apply conditional formatting on Pandas DataFrames
The Pandas library in Python has been predominantly used for data manipulation and analysis, but did you know that Pandas also allows for conditional formatting of DataFrames?
Conditional formatting is a feature that allows you to apply specific formatting to cells that fulfill certain conditions. It is common in spreadsheet applications like Microsoft Excel and it helps to draw viewer’s attention to important data points and values. It also allows you to visually dissect a dataset based on colors, making it easier to work with large datasets.
In this article, I will provide a simple guide on how you can apply conditional formatting on Pandas DataFrames. The codes presented in this article can be found as a notebook at this GitHub repo.
The dataset
In this article, we will be using the built-in Iris dataset from the seaborn
package. For simplicity, we will take a random sample of 10 observations.