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

Manage skewness

We've loaded the same dataset named data. Now your goal will be to remove skewness from var2 and var3 as they had a non-symmetric distribution as you've seen in the previous exercise plot. You will visualize them to make sure the problem is solved!

Libraries pandas, numpy, seaborn and matplotlib.pyplot have been loaded as pd, np, sns and plt respectively. Feel free to explore the dataset in the console.

Bu egzersiz

Customer Segmentation in Python

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

Egzersiz talimatları

  • Apply a logarithmic transformation to var2 and store it as new variable var2_log.
  • Apply a logarithmic transformation to var3 and store it as new variable var3_log.
  • Plot the distribution of var2_log.
  • Plot the distribution of var3_log.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Apply log transformation to var2
data['____'] = np.____(data['____'])

# Apply log transformation to var3
data['____'] = ____.____(____)

# Create a subplot of the distribution of var2_log
plt.____(2, 1, 1); ____.____(data['____'])

# Create a subplot of the distribution of var3_log
plt.____(2, 1, 2); ____.____(data['____'])

# Show the plot
plt.show()
Kodu Düzenle ve Çalıştır