isna(), and its identical alias isnull(), checks every element for missingness, which in pandas covers both NaN, the standard floating-point missing marker, and None, Python's own null value, treating both as equally missing. It's the standard first step for understanding a dataset's missing-data situation: chaining .sum() onto it gives a per-column count of missing values, and .any() checks whether any missing values exist at all, in a specific column or across the whole DataFrame.
1Understanding df.isna()
isna(), and its identical alias isnull(), checks every element for missingness, which in pandas covers both NaN, the standard floating-point missing marker, and None, Python's own null value, treating both as equally missing. It's the standard first step for understanding a dataset's missing-data situation: chaining .sum() onto it gives a per-column count of missing values, and .any() checks whether any missing values exist at all, in a specific column or across the whole DataFrame.
Chain .sum() onto isna() to get a quick per-column count of missing values across an entire DataFrame in one line, rather than checking each column individually.
import pandas as pd
import numpy as np
df = pd.DataFrame({"a": [1, np.nan, 3], "b": [np.nan, 5, 6]})
print(df.isna())2Practical Example
Here is a real-world application of df.isna() showing how it is used in production Pandas code.
import pandas as pd
import numpy as np
df = pd.DataFrame({"a": [1, np.nan, 3], "b": [np.nan, 5, 6]})
print(df.isna().sum())3Best Practices
Follow these guidelines when working with df.isna():
1. Use df.isna().sum() right after loading a dataset to get a per-column missing-value count as part of your initial data-quality check
2. Use isna() combined with boolean indexing to inspect the specific rows that have missing values in a column, before deciding how to handle them
3. Remember isna() and isnull() are exact aliases for the same method — pick whichever name you and your team prefer and use it consistently
Tip: Chain .sum() onto isna() to get a quick per-column count of missing values across an entire DataFrame in one line, rather than checking each column individually.
import pandas as pd
import numpy as np
df = pd.DataFrame({"a": [1, np.nan, 3], "b": [np.nan, 5, 6]})
print(df.isna())