Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Finding Null Values | Analyzing the Data
Pandas First Steps
course content

Course Content

Pandas First Steps

Pandas First Steps

1. The Very First Steps
2. Reading Files in Pandas
3. Analyzing the Data

book
Finding Null Values

Dataframes often contain missing values, represented as None or np.NaN. When working with dataframes, it's essential to identify these missing values. For this purpose, pandas offers specific methods.

The first of these is isna(), which returns a boolean dataframe. In this context, a True value indicates a missing value within the dataframe, while a False value suggests the value is present.

For clarity, let's review an example. Run the code provided to see a dataframe filled with True and False values, offering a clearer understanding.

123456789
import pandas as pd import numpy as np dataset = {'animal': [np.NaN, 'Dog', np.NaN, 'Cat','Parrot', None], 'name': ['Dolly', None, 'Erin', 'Kelly', None, 'Odie']} animal = pd.DataFrame(dataset) # Find missing values missing_value = animal.isna() print(missing_value)
copy

The second method is isnull(). It behaves identically to the previous one, with no discernible difference between them. Let's examine its application. Running the accompanying code will show if the resulting DataFrame matches the one from the prior example.

123456789
import pandas as pd import numpy as np dataset = {'animal': [np.NaN, 'Dog', np.NaN, 'Cat','Parrot', None], 'name': ['Dolly', None, 'Erin', 'Kelly', None, 'Odie']} animal = pd.DataFrame(dataset) # Find missing values missing_value = animal.isnull() print(missing_value)
copy
Task
test

Swipe to show code editor

Your objective is to pinpoint the missing values in a given dataframe named data_frame.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 6
toggle bottom row

book
Finding Null Values

Dataframes often contain missing values, represented as None or np.NaN. When working with dataframes, it's essential to identify these missing values. For this purpose, pandas offers specific methods.

The first of these is isna(), which returns a boolean dataframe. In this context, a True value indicates a missing value within the dataframe, while a False value suggests the value is present.

For clarity, let's review an example. Run the code provided to see a dataframe filled with True and False values, offering a clearer understanding.

123456789
import pandas as pd import numpy as np dataset = {'animal': [np.NaN, 'Dog', np.NaN, 'Cat','Parrot', None], 'name': ['Dolly', None, 'Erin', 'Kelly', None, 'Odie']} animal = pd.DataFrame(dataset) # Find missing values missing_value = animal.isna() print(missing_value)
copy

The second method is isnull(). It behaves identically to the previous one, with no discernible difference between them. Let's examine its application. Running the accompanying code will show if the resulting DataFrame matches the one from the prior example.

123456789
import pandas as pd import numpy as np dataset = {'animal': [np.NaN, 'Dog', np.NaN, 'Cat','Parrot', None], 'name': ['Dolly', None, 'Erin', 'Kelly', None, 'Odie']} animal = pd.DataFrame(dataset) # Find missing values missing_value = animal.isnull() print(missing_value)
copy
Task
test

Swipe to show code editor

Your objective is to pinpoint the missing values in a given dataframe named data_frame.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 6
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt