Analyzing Survey Data in Python
EbunOluwa Andrew
Data Scientist
.corr()
_first column_.corr(_second column_)
| City | Rank | Life expectancy_years | Happiness levels |
|------------|------|-----------------------|------------------|
| Amsterdam | 1 | 81.2 | 7.44 |
| Sydney | 2 | 82.1 | 7.22 |
| Vienna | 3 | 81 | 7.29 |
| Stockholm | 4 | 81.8 | 7.35 |
| Copenhagen | 5 | 79.8 | 7.64 |
| Helsinki | 6 | 80.4 | 7.8 |
| Fukuoka | 7 | 83.2 | 5.87 |
| Berlin | 8 | 80.6 | 7.07 |
| Barcelona | 9 | 82.2 | 6.4 |
import matplotlib.pyplot as plt
plt.scatter(healthy_city['Life expectancy_years'],
healthy_city['Happiness levels'])
happy_survey['Happiness levels'].corr(
happy_survey['Life expectancy_years'])
0.7245870841569987
Analyzing Survey Data in Python