Challenge: Transformation Grid
Taak
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.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 1. Hoofdstuk 8
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Geweldig!
Completion tarief verbeterd naar 8.33
Challenge: Transformation Grid
Veeg om het menu te tonen
Taak
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.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 1. Hoofdstuk 8
single