1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Statistics in Python

Connected

Exercise

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.

Instructions 1/2

undefined XP
  • 1
    • Create a scatterplot of happiness_score versus gdp_per_cap and calculate the correlation between them.
  • 2
    • Add a new column to world_happiness called log_gdp_per_cap that contains the log of gdp_per_cap.
    • Create a seaborn scatterplot of happiness_score versus log_gdp_per_cap.
    • Calculate the correlation between log_gdp_per_cap and happiness_score.