Pandas DataFrame notna() Method
Example
Replace all values in the DataFrame with True for NOT not-a-number values, otherwise False:
In this example we use a .csv file called data.csv
import pandas as pd
df = pd.read_csv('data.csv')
newdf = df.notna()
Try it Yourself »
Definition and Usage
The notna()
method returns a DataFrame object
where all the values are replaced with a Boolean value True for NOT NA (not-a
-number) values, and otherwise False.
Syntax
dataframe.notna()
Parameters
This method takes no parameters.
Return Value
A DataFrame with Boolean values.