MulaiMulai sekarang secara gratis

Transforming variables

When variables have skewed distributions, they often require a transformation in order to form a linear relationship with another variable so that correlation can be computed. In this exercise, you'll perform a transformation yourself.

pandas as pd, numpy as np, matplotlib.pyplot as plt, and seaborn as sns are imported, and world_happiness is loaded.

Latihan ini adalah bagian dari kursus

Introduction to Statistics in Python

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Scatterplot of happiness_score vs. gdp_per_cap
____
plt.show()

# Calculate correlation
cor = ____
print(cor)
Edit dan Jalankan Kode