Challenge: Data Cleaning
Oppgave
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:
- Load the dataset with
sns.load_dataset("titanic"). - Replace missing values in the column
agewith the column mean. - Replace missing values in the column
embarkedwith the most frequent value (mode). - Remove duplicate rows.
- Remove outliers in the column
fareusing the IQR method.
Return the final cleaned dataset as a DataFrame named cleaned_data.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 4
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Fantastisk!
Completion rate forbedret til 8.33
Challenge: Data Cleaning
Sveip for å vise menyen
Oppgave
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:
- Load the dataset with
sns.load_dataset("titanic"). - Replace missing values in the column
agewith the column mean. - Replace missing values in the column
embarkedwith the most frequent value (mode). - Remove duplicate rows.
- Remove outliers in the column
fareusing the IQR method.
Return the final cleaned dataset as a DataFrame named cleaned_data.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 4
single