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

single

bookChallenge: Filling Null Values

Svep för att visa menyn

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)
Uppgift

Swipe to start coding

You are given a DataFrame named wine_data.

  • Replace null values with the string 'no'.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 18
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

some-alt