Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Transformation Grid | Section
Data Preprocessing and Feature Engineering

bookChallenge: Transformation Grid

Завдання

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.

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 8
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

bookChallenge: Transformation Grid

Свайпніть щоб показати меню

Завдання

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.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 8
single

single

some-alt