0
0
Data Analysis Pythondata~10 mins

Identifying missing values (isnull, isna) in Data Analysis Python - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Identifying missing values (isnull, isna)
Start with DataFrame
Call isnull() or isna()
Check each cell for missing value
Return Boolean DataFrame
Use result for analysis or cleaning
We start with a data table, check each cell for missing values using isnull() or isna(), then get a table of True/False showing missing spots.
Execution Sample
Data Analysis Python
import pandas as pd

df = pd.DataFrame({
  'A': [1, None, 3],
  'B': [4, 5, None]
})

missing = df.isnull()
This code creates a table with some missing values and then finds where those missing values are.
Execution Table
StepDataFrame CellValueCheck isnull()Result (True=missing)
1df['A'][0]1isnull(1)False
2df['A'][1]Noneisnull(None)True
3df['A'][2]3isnull(3)False
4df['B'][0]4isnull(4)False
5df['B'][1]5isnull(5)False
6df['B'][2]Noneisnull(None)True
7End--All cells checked
💡 All cells checked for missing values, process ends.
Variable Tracker
VariableStartAfter Step 2After Step 6Final
df{'A':[1,None,3],'B':[4,5,None]}SameSameSame
missingNot createdPartial (after step 2)Partial (after step 6){'A':[False,True,False],'B':[False,False,True]}
Key Moments - 2 Insights
Why does isnull() return True for None but False for numbers?
Because None is the standard missing value marker in pandas, so isnull() flags it as True. Numbers are valid data, so they return False (see execution_table rows 1,2).
Are isnull() and isna() different in output?
No, both functions do the same check for missing values and return the same Boolean DataFrame (they are interchangeable).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the result of isnull() for df['B'][2]?
ATrue
BFalse
CNone
DError
💡 Hint
Check execution_table row 6 for df['B'][2] value and isnull() result.
At which step does the first missing value get detected?
AStep 1
BStep 2
CStep 4
DStep 6
💡 Hint
Look at execution_table rows 1 and 2 to see when True first appears.
If the value None in df['A'][1] was replaced by 0, what would be the isnull() result at step 2?
ATrue
BNone
CFalse
DError
💡 Hint
Recall that isnull() returns False for valid numbers like 0 (see execution_table row 1).
Concept Snapshot
Use df.isnull() or df.isna() to find missing values in a DataFrame.
Returns a Boolean DataFrame with True where data is missing.
Missing values like None or NaN are flagged True.
Useful for cleaning or analyzing incomplete data.
Full Transcript
We start with a DataFrame containing some missing values marked as None. Calling isnull() checks each cell and returns True if the cell is missing data, otherwise False. The output is a Boolean DataFrame showing exactly where data is missing. This helps us find and handle missing data easily. Both isnull() and isna() do the same check and can be used interchangeably.