Python Practice › Pandas Programs › Program 83

Detect missing values

EasyPandas Programs · 83 of 95

Write a pandas program to show where values are missing.

Advertisement
Output
    name    age
0  False  False
1  False   True
2  False  False
3  False   True

Approach

  1. isna().

Solution

Python
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
Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More pandas programs

← All 95 Pandas Programs