Pearson vs Spearman
Linear versus rank relationships.
Two Ways to Correlate
Not all correlation is the same. The two most common methods, Pearson and Spearman, ask slightly different questions about how your variables relate. 🔍
What Pearson Measures
Pearson measures how well a straight line fits your data. It is the classic choice when both variables are numeric and their relationship looks roughly linear.
r = df["income"].corr(df["spending"], method="pearson")
print(round(r, 2))