Detecting any missing values with .isna().any() is the fastest, most lightweight way to answer the question: “Does this column (or the whole dataset) have even a single missing value?” In real workflows, you run this check seconds after loading data — before diving into counts, heatmaps, or imputation strategies.
In pandas, .isna().any() returns a boolean Series (or single boolean for scalars) — True if the column contains at least one NaN/None/null, False otherwise. It’s blazing fast and memory-efficient, especially on huge DataFrames.
1. Basic Usage (Pandas)
import pandas as pd
# Realistic example: messy survey data
data = {
'name': ['Alice', 'Bob', 'Charlie', 'David', 'Eve'],
'age': [25, None, 34, 28, 31],
'salary': [55000, 72000, None, 61000, None],
'city': ['New York', 'Chicago', 'Los Angeles', 'Boston', 'Seattle']
}
df = pd.DataFrame(data)
# Quick check: any missing per column?
print("Any missing values per column?")
print(df.isna().any())
# One-liner: columns that have missing values
missing_cols = df.columns[df.isna().any()].tolist()
print("\nColumns with missing values:", missing_cols)
# Whole DataFrame has any missing at all?
print("\nDataset has missing values anywhere?", df.isna().any().any())
**Typical output:**