BaşlayınÜcretsiz Başlayın

Observing categoricals

Remember from the previous exercise that:

  • Ordinal variables have two or more categories which can be ranked or ordered
  • Nominal variables have two or more categories which do not have an intrinsic order

In your dataset:

  • salary is an ordinal variable
  • department is a nominal variable

In this exercise, you're going to observe the categorical variables found in the previous exercise. To do that, first of all, you will import the pandas library and read the CSV file called "turnover.csv". Then, you will print the unique values of those variables.

Bu egzersiz

HR Analytics: Predicting Employee Churn in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Import pandas (as pd) to read the data (this has already been done for you).
  • Read the "turnover.csv" file and save it in a DataFrame called data.
  • Print the unique values of the "department" column.
  • Print the unique values of the "salary" column.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import pandas (as pd) to read the data
import pandas as pd

# Read "turnover.csv" file and save it in a DataFrame called data
data = pd.read_csv(____)

# Print the unique values of the "department" column
print(data.____.____())

# Print the unique values of the "salary" column
print(data.____.____())
Kodu Düzenle ve Çalıştır