Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Data Cleaning | Section
Data Preprocessing and Feature Engineering

bookChallenge: Data Cleaning

Opgave

Swipe to start coding

You are given the Titanic dataset loaded through the Seaborn library. Your task is to clean the dataset using pandas by performing the following steps:

  1. Load the dataset with sns.load_dataset("titanic").
  2. Replace missing values in the column age with the column mean.
  3. Replace missing values in the column embarked with the most frequent value (mode).
  4. Remove duplicate rows.
  5. Remove outliers in the column fare using the IQR method.

Return the final cleaned dataset as a DataFrame named cleaned_data.

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 4
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

close

bookChallenge: Data Cleaning

Stryg for at vise menuen

Opgave

Swipe to start coding

You are given the Titanic dataset loaded through the Seaborn library. Your task is to clean the dataset using pandas by performing the following steps:

  1. Load the dataset with sns.load_dataset("titanic").
  2. Replace missing values in the column age with the column mean.
  3. Replace missing values in the column embarked with the most frequent value (mode).
  4. Remove duplicate rows.
  5. Remove outliers in the column fare using the IQR method.

Return the final cleaned dataset as a DataFrame named cleaned_data.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 4
single

single

some-alt