Python Practice › Pandas Programs › Program 83
Detect missing values
Write a pandas program to show where values are missing.
Output
name age 0 False False 1 False True 2 False False 3 False True
Approach
isna().
Solution
import numpy as npimport pandas as pddf = pd.DataFrame({"name": ["Alex", "John", "Peter", "Klaus"], "age": [30, np.nan, 29, np.nan]})print(df.isna())Output
name age 0 False False 1 False True 2 False False 3 False True
Learn the concept
New to this topic? Read the lesson, then come back.