The isna() method in Pandas
The isin() method can be used with both DataFrame and Series and is used to detect missing values. It returns a boolean same-sized object indicating if the values are NA, if it is NA, it returns True otherwise False.
Syntax a) pandas.DataFrame.isna()
b) pandas.Series.isna()
In this exercise, we are using the datasource employeeswithna.csv. You can download the datasource and use for the transformation.
Example: Load the Dataframe.
Python
import pandas as pd mydata=pd.read_csv("employeeswithna.csv") mydata
The output of the above code is shown below:
Let’s check the values in the dataframe is NaN or not. It returns the same sized object with boolean values.
Python
mydata.isna()
The output of the above code is shown below: