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

Converting a column type

If you take a look at the volunteer dataset types, you'll see that the column hits is type object. But, if you actually look at the column, you'll see that it consists of integers. Let's convert that column to type int.

Bu egzersiz

Preprocessing for Machine Learning in Python

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

Egzersiz talimatları

  • Take a look at the .head() of the hits column.
  • Convert the hits column to type int.
  • Take a look at the .dtypes of the dataset again, and notice that the column type has changed.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Print the head of the hits column
print(volunteer["hits"].____)

# Convert the hits column to type int
volunteer["hits"] = ____

# Look at the dtypes of the dataset
print(volunteer.____)
Kodu Düzenle ve Çalıştır