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

Pandas · Function

pd.isna

Detect whether a scalar or array-like object contains missing values. Scalars return one boolean, while array-like inputs return corresponding boolean indicators.

How it works

pd.isna tests a scalar or array-like object for missing values. Scalars produce one boolean; array-like inputs produce a matching boolean structure, preserving the input type for Series and DataFrame objects.

Syntax

pandas.isna(obj)

Parameters

NameTypeDescription
objscalar or array-likeObject to check for null or missing values.

Returns

bool or array-like of bool

Key points

  • Use pd.isna to create missing-value indicators for scalar or array-like data.
  • The single input can be an individual value or a collection such as an ndarray, Index, Series, or DataFrame.
  • Missingness is evaluated according to the value type, including numeric, object, and datetime-like representations.
  • A scalar input produces exactly one bool result.
  • Array inputs receive one boolean indicator per corresponding element.
  • An Index input produces a NumPy boolean array.

Common mistakes

  • A scalar call returns one boolean, even when the scalar is a string.
  • Series and DataFrame inputs return the corresponding pandas type rather than a plain array.

Example: Detect missing values

import numpy as np
import pandas as pd

values = pd.Series([1, None, np.nan, "ok"])
print(pd.isna(values).tolist())
print(pd.isna("ok"))
print(pd.isna(pd.NA))

Creates a boolean Series mask for missing elements and returns scalar booleans for scalar inputs.

When to use it

Build a boolean mask to select missing entries.

Filtering

Check scalar values before converting or processing them.

Validation

Locate nulls across Series, DataFrames, arrays, and indexes.

Data cleaning

Interview questions

QWhat does pandas.isna return?

pd.isna(obj) identifies missing values in scalars and array-like inputs. A scalar returns a boolean, while an array-like input returns boolean indicators for corresponding elements.

Follow-up: How does the result differ for a DataFrame? It returns a same-shaped DataFrame containing boolean missingness indicators.

QWhich kinds of values does pandas.isna detect?

The function recognizes NaN in numeric arrays, None or NaN in object arrays, and NaT in datetimelike values. It therefore provides a common missing-value test across several pandas data representations.

Follow-up: What should be used to identify non-missing values? Use the documented inverse operation, pandas.notna.

QWhat is the function signature and parameter?

The required argument is obj, described as a scalar or array-like object to check for null or missing values. The function accepts one object and does not require additional arguments.

Follow-up: How can missing rows be selected from a Series? Apply the resulting boolean mask, for example series[pd.isna(series)].

  • pandas.notna
  • pandas.isnull
  • pandas.DataFrame.isna
  • pandas.Series.isna

Source: pandas.isna — pandas 3.0.5 documentation. Checked 2026-10-15.