The Pursuit of Happiness

The Pursuit of Happiness

Visual analysis of world happiness from 2015–2019. We all chase happiness in our lives. Yes, money is important but if you ask most people, they want to be happy.

We all chase happiness in our lives. Yes, money is important but if you ask most people, they want to be happy. But what constitutes happiness? It is an answer I have tried to search for in a lot of books and blogs including a number of medium articles!

So you can guess my excitement and surprise when I found out that an abstract concept such as happiness could be quantified!

The World Happiness Report is a “..landmark survey of the state of global happiness that ranks 156 countries by how happy their citizens perceive themselves to be.” It is a publication of the Sustainable Development Solutions Network and is based on data collected from the Gallup World Poll. According to the report,.. “the rankings are based on answers to the main life evaluation question asked in the poll. This is called the Cantril ladder: it asks respondents to think of a ladder, with the best possible life for them being a 10, and the worst possible life being a 0. They are then asked to rate their own current lives on that 0 to 10 scale.”

Having studied economics and public policy during graduate school, I naturally get excited by data on socio-economic development. Moreover, the publication is gaining global recognition as governments, organizations and civil society are increasingly using happiness indicators to inform policy-making decisions. So I decided to better understand this concept through data visualization.

The objective of the visual analysis was to:

  • Analyze the global state of happiness as well as the factors behind it
  • How the state of happiness has changed over the last 5 years (2015–2019)
  • How different regions compare
  • How the different countries measure against the indicators of happiness


Data for the previous years can be easily obtained from Kaggle. There are 5 CSV files containing data on 141 countries for the years 2015 to 2019. The columns following the happiness score estimate the extent to which each of six indicators — GDP per Capita, social or family support, health or life expectancy, freedom, government trust or perception of corruption, and generosity — contribute to making life evaluations higher in each country.


The dataset was fairly clean and easy to work with. Data cleaning and preprocessing were done using Python. After renaming columns (so that they have consistent names) and basic cleaning, the 5 CSV files were merged into one final dataset. The final pandas data-frame has 141 rows corresponding to each country and 46 columns corresponding to happiness indicators and scores across the different years.

Image for post

Dataframe (image by author)

Now coming to the interesting part!


The visualization was done using Tableau and for a select few countries including the top 10 happiest nations (on average), the bottom 5 (least happy) nations, and the countries of interest e.g. India, China, USA, UK, Syria, UAE, and Spain. Also, for most of the plots, data from the most recent report, that is, 2019 was considered.

I also created a “Happiness Spotlight” calculated field based on the range of happiness scores. This calculated field makes it very easy to visualize the data as it color-codes the data. The minimum cut-offs were obtained by binning the happiness scores into ‘Low’, ‘Medium’, and ‘High’ in Python.

data-visualization data-science public-policy python happiness

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Data Science With Python Training | Python Data Science Course | Intellipaat

🔵 Intellipaat Data Science with Python course: this Data Science With Python Training video, you...

Data Visualization With Python | Data Visualization | Python For Data Science

🔥To access the slide deck used in this session for Free, click here: 🔥 Great Learning brings you this live session on 'Data Vis...

Python for Data Science | Data Science With Python | Python Data Science Tutorial

🔥Intellipaat Python for Data Science Course: this python for data science video you will learn e...

Applied Data Science with Python Certification Training Course -IgmGuru

Master Applied Data Science with Python and get noticed by the top Hiring Companies with IgmGuru's Data Science with Python Certification Program. Enroll Now

What Are The Advantages and Disadvantages of Data Science?

Online Data Science Training in Noida at CETPA, best institute in India for Data Science Online Course and Certification. Call now at 9911417779 to avail 50% discount.