Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Filling Null Values | Section
Data Manipulation with pandas
Seksjon 1. Kapittel 18
single

single

bookChallenge: Filling Null Values

Sveip for å vise menyen

To handle null values while keeping all rows in the DataFrame, use the fillna() method. It allows you to replace each empty cell with a specific value (such as a string or number) instead of removing it.

To replace null values with the number 0, the fillna() method is used:

import pandas as pd
df = pd.read_csv(file.csv)
new_df = df.fillna(0)
Oppgave

Swipe to start coding

You are given a DataFrame named wine_data.

  • Replace null values with the string 'no'.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 18
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

some-alt