Challenge: Transformation Grid
Task
Swipe to start coding
You are given the Titanic dataset from the seaborn library.
Your goal is to perform data transformation using pandas and scikit-learn.
Perform the following steps:
- Load the dataset with
sns.load_dataset("titanic"). - Fill missing values in
ageandembarked(mean and mode). - Encode the categorical columns
sexandembarkedusingpd.get_dummies()(drop the first category to avoid redundancy). - Scale the numeric columns
ageandfareusingStandardScaler. - Create a new column
family_size = sibsp + parch + 1. - Return the transformed dataset as
transformed_data.
Print .head() to preview the result.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 2. 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 that in simpler terms?
What are some examples related to this topic?
How does this information apply to real-world situations?
Awesome!
Completion rate improved to 8.33
Challenge: Transformation Grid
Swipe to show menu
Task
Swipe to start coding
You are given the Titanic dataset from the seaborn library.
Your goal is to perform data transformation using pandas and scikit-learn.
Perform the following steps:
- Load the dataset with
sns.load_dataset("titanic"). - Fill missing values in
ageandembarked(mean and mode). - Encode the categorical columns
sexandembarkedusingpd.get_dummies()(drop the first category to avoid redundancy). - Scale the numeric columns
ageandfareusingStandardScaler. - Create a new column
family_size = sibsp + parch + 1. - Return the transformed dataset as
transformed_data.
Print .head() to preview the result.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 4
single