Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Introduction to Statistics in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

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

# Calculate correlation
cor = ____
print(cor)
Code bewerken en uitvoeren