Learn practical skills, build real-world projects, and advance your career

Analysis of World Happiness Report 2017

Factors That Keep Citizens Happy

The World Happiness Report is an annual publication from United Nations Sustainable Developemnt Netwirk Solutions. As the title suggests, it ranks the countries of the world in the basis of their happiness. Respondents are asked to rate their own lives on a scaale of 0 to 10, 0 being the lowest and 10 being the highest. There are 6 metrics to capture their happiness, namely

  • GDP per capita
  • Social support
  • Life expectancy
  • Freedom
  • Generosity
  • Trust in Government
    These metrics are used to estimate how much each of them contribute to the overall happiness in each country.

Let's get to the dataset now.

Chapter 1: Reading the Dataset

# Importing the necessary libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Now we store the datasets into a dataframe of our own
with open("2017.csv") as report:
    report_df = pd.read_csv(report) 
with open("country_profile_variables.csv") as country:
  country_df = pd.read_csv(country)

We have 2 datasets. The first one is the World Happiness Report. The second one is a dataset containing various metrics like the GDP of a country, sex ratio, etc. I hope to describe some of the contributors of happiness with these metrics.