GDP Life Expentancy Exploration

Enrique Viveros Acosta
5 min readJun 10, 2021

The gross domestic product (GDP) is a pretty common term, we hear it on the news all the time, politicians use it as the holy grail, and even on the street suddenly you may accross it. However it has also its detractors, back on 1968 at the university of Kansas Bob Kennedy said :

“ (GDP) … measures everything except that which is worthwhile”

“Yet the gross national product does not allow for the health of our children, the quality of their education or the joy of their play. It does not include the beauty of our poetry or the strength of our marriages, the intelligence of our public debate or the integrity of our public officials.”

Nowadays the debate is still open. Does it really show how good or bad the economy is performing? Is it measured accurately? Can it really comunicate us something?

I am afraid there is no simple answer for that question, and in this article I am going to try to ask the genie of the lamp if there is any relationship between the gdp and the life expectancy. The dataset was obtained from Codecademy and it contains the gdp and life expetancy for 6 countries for a period of 15 years .

You may find the complete code along with the csv and jupyter file in this repository:


  • Has life expectancy increased over time in the six nations?
  • Has GDP increased over time in the six nations?
  • Is there a correlation between GDP and life expectancy of a country?
  • What is the average life expectancy in these nations?

Data Exploration

To start we loaded the data from the csv file and take a glimpse of it, we wanted to know which countries and what period of years were involved. In this case we have 6 different countries for this data set: 3 located in America 1 in Europe 1 in Africa and 1 in Asia and the years goes from 2000 to 2011.

Also to get a better grasp of the data we do some exploratory plots just to undestand better its distribution, skewness, modality and check for outliers


As we had the data for several countries and several years the best way to work with the data was to group it, doing so we got:

doing this we created the average values for GDP and LEB grouped by country for an initial anaylis, which could be seen in the following plots:

Doing this we can take see, how the live expectancy in the world for most of the cases is above the 70’s except for Zimbabwe which is falling almost 20 years behind. Also we can see how massive is the GDP of the United States in comparison with the other countries in the data set (which doesn’t account for a equally massive difference of life expetancy with the other countries). As the GDP for Zimbabwe is so small it can not be seen in the plot. Now we want to see how over the years this two measures have grown.

Taking the wholeness of the data we can see how the countries with the bigger gdp growth were China and the U.S, however the country with the most notorious GDP growth was Zimbabwe. However the country with the most notorious life expectancy change was Zimbabwe.

To see if there is a correlation between GDP and Life expectancy we plot the both:

We can see here how the GDP is correlated with the life expectancy, many of the countries present a linear relationship however China present more an exponencial one. In the case of Zimbabwe the life expectancy shrinked a while, but after the 0.6 trillion barrier it presented a really accelerated growth shortening the distance with the rest of the countries.


Data presents a lot of opportunities to make better conclusions, discover unseen patterns, ask better questions and much more. Data Science and Data Analysis is a growing and interesting field to learn or be considered.

In this article I wanted to present a small glimpse on a data analysis data set, using exploratory data anaylisis, finding a question to solve, gattering the data, looking what kind of data we have and looking for outliers or dataset changes. The libraries used to do the visualization were Matplotlib and Seaborn, you may find the complete version of the code and anaylisis in the following repository: