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

Aggregating numerical features

A good use case for taking an aggregate statistic to create a new feature is when you have many features with similar, related values. Here, you have a DataFrame of running times named running_times_5k. For each name in the dataset, take the mean of their 5 run times.

Bu egzersiz

Preprocessing for Machine Learning in Python

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

Egzersiz talimatları

  • Use the .loc[] method to select all rows and columns to find the .mean() of the each columns.
  • Print the .head() of the DataFrame to see the mean column.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Use .loc to create a mean column
running_times_5k["mean"] = ____.loc[____, ____].____(axis=____)

# Take a look at the results
print(____)
Kodu Düzenle ve Çalıştır