Pandas DataFrame notna() method with examples

Spread the love

The notna method in pandas detect existing (non-missing) values in a dataframe or series. It return a boolean same-sized object indicating if the values are not NA. Non-missing values get mapped to True.

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 not NA –

To show which entries in a DataFrame are not NA, we can use the notna method in pandas.


2 . Show which entries in a Series are not NA –

We can also use notna method with a series.

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

# check which entries in the series are not NA

Rating: 1 out of 5.

Leave a Reply