Pandas DataFrame isna() method with examples

Spread the love

The isna method in pandas detect missing values in a dataframe. It return a boolean same-sized object indicating if the values are NA. NA values, such as None or numpy.NaN, gets mapped to True values. Everything else gets mapped to False values.

Syntax –


Examples –

Let’s read a dataset to work with.

import pandas as pd

url = ''
df = pd.read_csv(url)

1 . Show which entries in a DataFrame are NA –

To show which entries are NA in a DataFrame, we can use the isna() method in pandas.


2 . Show which entries in a series are NA –

We can also use isna method with a series.

# create a series
s = df['apple']

# check which entries in the series are NA

Rating: 1 out of 5.

Leave a Reply