Data Analysis Programming of World Happiness Ranking

I wrote a program in Python which generated a chart based on the raw data of the World Happiness Ranking 2017 to compare relative factors of happiness across North American countries.

This Python program was created as the final project for CPSC103 (Introduction to Systematic Program Design).

Project aim:

My project takes information from the World Happiness Ranking 2017 data and produces a stacked bar graph using Python code, which reflect the factor scores of each North American country that participated in the calculation.

Why did I choose this project?

I wanted to do this project because I was interested to see the relative disparities in quality of life and happiness between the countries in North America, and how much each aspect calculated plays into the total happiness score for each country, which may show certain patterns in people's perception of their country.

Skills used and Challenges:

  • Data processing: Through writing this program, I became more familiar with how computer software generated graphs from complex data. By building a program on my own, I understood the detailed steps that software took to gradually filter for necessary data. It also familiarized me with how human intentions were transferred into computer directions.
  • Problem-solving: This was my first time learning how to write code, and I learned the most from solving coding errors by myself. For this project in particular, I had to integrate a code that adjusted the width and height of the graph in order to remove the overlap between labels.

Error:                                                           Solution:


  • Organization: This project required a lot of helper functions (short codes that complete shorter tasks to support the larger functional code) and involved processing data from 156 countries. As a result, the total string of code was extremely long and took a long time to navigate through scrolling.

To enable easier access, I made separate python files for each step of the code, so that whenever I needed to access a string of code from a much earlier point in the file, I could simply open up a separate file and copy and paste, without wasting time scrolling back and forth through the file I was working on.

Final outcomes:

Through this introduction to systemic programming, I became interested in the concept of how computers are used to help human beings, and to what extent are they an extension of humanity. I explore this concept in my paper on posthumanism.

If you would like to look at the code, please email me at

Share this learning activity with others

Learning Significance

  1. Morals and Ethics (Universal Code):
    Rather than being able to learn any concrete information, the process of creating this program generated a set of knowledge questions in my mind about the extent to which these scores and rankings were accurate of reality.
    How much can happiness be quantified?
    What creates the discrepancy in scores between similarly developed countries, such as Canada versus the United States?
    Why do most countries share similar proportional factors in happiness scores (e.g. All countries score the lowest in Trust)?