Challenge: Data Cleaning
Task
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.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 4
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Awesome!
Completion rate improved to 8.33
Challenge: Data Cleaning
Swipe to show menu
Task
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.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 4
single