Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
While making a Data Frame from a csv file, many blank columns are imported as null value into the Data Frame which later creates problems while operating that data frame. Pandas isnull() and notnull() methods are used to check and manage NULL values in a data frame.
Dataframe.isnull()
Syntax: Pandas.isnull(“DataFrame Name”) or DataFrame.isnull()
Parameters: Object to check null values for
Return Type: Dataframe of Boolean values which are True for NaN values
To download the CSV file used, Click Here.
Example #1: Using isnull()
In the following example, Team column is checked for NULL values and a boolean series is returned by the isnull() method which stores True for ever NaN value and False for a Not null value.
Python
# importing pandas packageimport pandas as pd# making data frame from csv filedata = pd.read_csv("employees.csv")# creating bool series True for NaN valuesbool_series = pd.isnull(data["Team"])# filtering data# displayind data only with team = NaNdata[bool_series] |
Output:
As shown in output image, only the rows having Team=NULL are displayed.

Dataframe.notnull()
Syntax: Pandas.notnull(“DataFrame Name”) or DataFrame.notnull()
Parameters: Object to check null values for
Return Type: Dataframe of Boolean values which are False for NaN values
Example #1: Using notnull()
In the following example, Gender column is checked for NULL values and a boolean series is returned by the notnull() method which stores True for ever NON-NULL value and False for a null value.
Python
# importing pandas packageimport pandas as pd# making data frame from csv filedata = pd.read_csv("employees.csv")# creating bool series False for NaN valuesbool_series = pd.notnull(data["Gender"])# displayed data only with team = NaNdata[bool_series] |
Output:
As shown in output image, only the rows having some value in Gender are displayed.

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
Recommended Posts:
- Python | Pandas dataframe.notnull()
- Python | Pandas Index.notnull()
- Python | Pandas TimedeltaIndex.notnull
- Python | Pandas Series.notnull()
- Python | Pandas Index.isnull()
- Python | Pandas TimedeltaIndex.isnull
- Python | Pandas Series.isnull()
- Python | pandas.to_markdown() in Pandas
- Add a Pandas series to another Pandas series
- Replace the column contains the values 'yes' and 'no' with True and False In Python-Pandas
- Ceil and floor of the dataframe in Pandas Python – Round up and Truncate
- Login Application and Validating info using Kivy GUI and Pandas in Python
- Python | Data Comparison and Selection in Pandas
- Python | Difference between Pandas.copy() and copying through variables
- Python | Pandas Series.str.lower(), upper() and title()
- Python | Pandas Series.str.strip(), lstrip() and rstrip()
- Python | Working with date and time using Pandas
- Python | Pandas Series.str.ljust() and rjust()
- Python | Change column names and row indexes in Pandas DataFrame
- Python | Pandas df.size, df.shape and df.ndim
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

