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

Conteúdo do Curso

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 NaN. When working with DataFrames, it's essential to identify these missing values because they can distort calculations, lead to inaccurate analyses, and compromise the reliability of results.

Addressing them ensures data integrity and improves the performance of tasks like statistical analysis and machine learning. 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, we'll apply this method on the animals DataFrame. The isna() method will return a DataFrame filled with True/False values, where each True value represents a missing value in the animals DataFrame.

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

The second method is isnull(). It behaves identically to the previous one, with no discernible difference between them.

Tarefa
test

Swipe to show code editor

Your objective is to pinpoint the missing values in a given DataFrame named wine_data.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 6
toggle bottom row

book
Finding Null Values

DataFrames often contain missing values, represented as None or NaN. When working with DataFrames, it's essential to identify these missing values because they can distort calculations, lead to inaccurate analyses, and compromise the reliability of results.

Addressing them ensures data integrity and improves the performance of tasks like statistical analysis and machine learning. 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, we'll apply this method on the animals DataFrame. The isna() method will return a DataFrame filled with True/False values, where each True value represents a missing value in the animals DataFrame.

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

The second method is isnull(). It behaves identically to the previous one, with no discernible difference between them.

Tarefa
test

Swipe to show code editor

Your objective is to pinpoint the missing values in a given DataFrame named wine_data.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 6
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt