0Pricing
Data Science Academy · Lesson

Find the NaNs Hiding in Your Table

isna, sum, and a missingness map.

Find the NaNs Hiding in Your Table is a free Data Science Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Data Science Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Why Missing Data Matters

Real datasets are full of gaps. Before any analysis, you need to know where missing values hide, because they quietly skew every result you trust. 🔎

Meet NaN

In pandas, an empty cell usually shows up as NaN, short for Not a Number. It is the standard marker for a value that simply is not there.

NaN Is Not Zero

A common trap: treating NaN as if it were 0. Zero is a real measurement, while NaN means you have no measurement at all. They tell very different stories.

Spotting Gaps With isna

The method isna() returns a table of True and False, one flag per cell, marking exactly where values are missing across your whole DataFrame.

missing = df.isna()
print(missing.head())

Count Missing Per Column

Chain isna().sum() to count missing cells in every column at once. True counts as 1, so each total is the number of gaps in that column.

df.isna().sum()

The Overall Total

Want one grand total of every gap in the table? Add another sum() to collapse the per-column counts into a single number.

df.isna().sum().sum()

Missing as a Percentage

Raw counts can mislead on big tables. Divide by len(df) to see the share of each column that is missing, which guides how seriously to react.

df.isna().mean() * 100

notna for the Filled Side

The opposite of isna is notna(), which flags cells that do hold a value. It is handy when you want to keep only complete rows.

df.notna().sum()

A Quick Missingness Map

A heatmap of isna() turns gaps into a picture, so clusters of missing rows or columns jump out far faster than scanning numbers.

import seaborn as sns
sns.heatmap(df.isna())

Rows With Any Gap

To inspect problem rows, filter where any value is missing along each row. This shows you exactly which records need attention.

df[df.isna().any(axis=1)]

Why Mapping Comes First

Mapping missingness before you fix anything keeps you honest. You decide how to handle gaps based on evidence, not on a guess about how bad they are.

Quick Check

You want the number of missing values in each column. Which expression gives it?

Recap: You Can See the Gaps

You now find missing data with isna, count it per column, view it as a percentage, and map it visually. Seeing the gaps is the first step to fixing them.

Frequently asked questions

Is the “Find the NaNs Hiding in Your Table” lesson free?

Yes — the full text of “Find the NaNs Hiding in Your Table” is free to read here on the web, and the Data Science Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Data Science Academy course, upgrade to CoddyKit PRO.

What will I learn in “Find the NaNs Hiding in Your Table”?

isna, sum, and a missingness map. You practise Data Science Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Data Science Academy?

No prior experience is required. Data Science Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Find the NaNs Hiding in Your Table” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Data Science Academy lesson?

Yes. Every Data Science Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Find the NaNs Hiding in Your Table
  2. Drop vs Fill: Choosing Wisely
  3. Impute With Mean, Median, or Mode
  4. Fix dtypes and Duplicate Rows
← Back to Data Science Academy