Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Pandas · Module

df.isnull

Detect missing values in a DataFrame by returning a same-sized boolean mask. Missing entries are True, while other entries are False; isnull() is an alias for isna().

How it works

Calling isnull() examines every cell and produces a same-shaped boolean DataFrame. Missing values become True; other values become False. It is an alias of isna(), so either spelling provides the same result.

Syntax

DataFrame.isnull()

Returns

A boolean DataFrame of the same size, with True for missing values and False otherwise.

Key points

  • The method creates a mask for locating missing data in a DataFrame.
  • Its result has the same row and column dimensions as the source and contains booleans.
  • Common missing markers including None and NaN produce True in the corresponding output cells.
  • Values that are not recognized as missing produce False.
  • The method is interchangeable with the DataFrame isna() method.

Common mistakes

  • Empty strings and positive or negative infinity are not marked as missing by this method.

Example: Find missing cells

import pandas as pd

frame = pd.DataFrame({
    "name": ["Ada", None, "Linus"],
    "score": [95, 88, None],
})

missing = frame.isnull()
print(missing)

Creates a boolean DataFrame marking the missing entries in each original cell.

When to use it

Locate missing cells

Audit tabular data before cleaning or validation.

Filter rows with missing values

Build boolean filters for incomplete records.

Summarize null counts

Quantify missingness by field.

Interview questions

QWhat does DataFrame.isnull() return?

It returns a boolean DataFrame with the same dimensions as the input. Each position is True when its corresponding value is considered missing and False otherwise.

Follow-up: How would you count missing values per column? Use frame.isnull().sum(); boolean values are summed column-wise.

QHow is isnull related to isna?

isnull() and isna() are aliases, so they have equivalent behavior. The choice is mainly a naming preference or a consistency decision within a codebase.

Follow-up: How can you test whether an entire row has at least one missing value? Apply .any(axis=1) to the boolean result.

QWhich values does isnull identify as missing?

Values such as None and numpy.NaN are mapped to True, while non-missing values map to False. The output preserves the DataFrame's shape, allowing masks to be applied directly to the original data.

Follow-up: How can you select only rows containing missing data? Use frame[frame.isnull().any(axis=1)].

  • pandas.DataFrame.isna
  • pandas.isnull
  • pandas.isna

Source: pandas.DataFrame.isnull — pandas 3.0.6 documentation. Checked 2026-10-15.