Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Transformation Grid | Section
Practice
Projects
Quizzes & Challenges
Quizzen
Challenges
/
Data Preprocessing and Feature Engineering

bookChallenge: 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:

  1. Load the dataset with sns.load_dataset("titanic").
  2. Fill missing values in age and embarked (mean and mode).
  3. Encode the categorical columns sex and embarked using pd.get_dummies() (drop the first category to avoid redundancy).
  4. Scale the numeric columns age and fare using StandardScaler.
  5. Create a new column family_size = sibsp + parch + 1.
  6. Return the transformed dataset as transformed_data.

Print .head() to preview the result.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 8
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

close

bookChallenge: 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:

  1. Load the dataset with sns.load_dataset("titanic").
  2. Fill missing values in age and embarked (mean and mode).
  3. Encode the categorical columns sex and embarked using pd.get_dummies() (drop the first category to avoid redundancy).
  4. Scale the numeric columns age and fare using StandardScaler.
  5. Create a new column family_size = sibsp + parch + 1.
  6. Return the transformed dataset as transformed_data.

Print .head() to preview the result.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 8
single

single

some-alt