Everyone working in the data field knows that data is never perfectly clean, and missing values are almost inevitable. That’s why it’s important to check whether your dataset contains any null values before you start analyzing it. Below is a dataframe showing visits to fast food stores.
shape: (4, 3)
| str |
i64 |
str |
| "Burger King" |
4 |
"It's good" |
| "McDonald's" |
7 |
null |
| "Shake Shack" |
10 |
"Loved it" |
| "Pizza Hut" |
null |
null |
Check number of nulls
To check how many null values are in each column, use the Polars method null_count like this:
You can now see the number of null values in each column. For instance, Opinion has 2 null values.
Enroll in my Polars course to learn more ways to analyze your data.