MulaiMulai sekarang secara gratis

Separating Target and Features

In order to make a prediction (in this case, whether an employee would leave or not), one needs to separate the dataset into two components:

  • the dependent variable or target which needs to be predicted
  • the independent variables or features that will be used to make a prediction

Your task is to separate the target and features. The target you have here is the employee churn, and features include everything else.

Reminder: the dataset has already been modified by encoding categorical variables and getting dummies.

pandas has been imported for you as pd.

Latihan ini adalah bagian dari kursus

HR Analytics: Predicting Employee Churn in Python

Lihat Kursus

Petunjuk latihan

  • Set the target and features:
    • Choose the dependent variable column (churn) and set it as target.
    • .drop() the column churn to set everything else as features.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Set the target and features

# Choose the dependent variable column (churn) and set it as target
target = data.____

# Drop column churn and set everything else as features
features = data.____("____",axis=1)
Edit dan Jalankan Kode