With ChatGPT’s Code Interpreter finally in Beta and available for testing, I’ve been playing with the tool to see what it can do. One of the tests I ran used the World Happiness Index scores, along with corresponding data sets from the World Bank to see if we could figure out some correlations…I then compared them with the official report. You’ll find a run through below…
A Summary Of Findings, First:
Here’s how ChatGPT summarized the findings:
Through an in-depth analysis of the World Happiness Index and World Bank data, we’ve discovered fascinating insights into what correlates with happiness around the globe. Countries with higher life expectancies, better educational enrollment, and greater economic prosperity, as measured by GDP per capita, tend to report higher levels of happiness. Conversely, countries with high young age dependency ratios, high under-5 mortality rates, and low government expenditure on tertiary education per student are associated with lower happiness indices. Our visualizations beautifully illustrate these relationships, shedding light on the complex interplay of various factors that contribute to a nation’s happiness. However, it’s essential to remember that correlation does not imply causation, and these insights should be a starting point for more nuanced research. #DataScience #WorldHappinessReport #HappinessIndex 🌍😊💼
The Data Used
- World Happiness Index by Reports [2013-2023] – source
- World Development Indicators (World Bank) – source
- World Happiness Report 2022 – source
Which Countries Are Happiest…and Unhappiest?
I started with the easy stuff and asked ChatGPT with Code Interpreter to analyze the uploaded dataset and then provide a list of the top and bottom countries on the list.
Pretty straightforward…and it looks like the trend matches what was published in the official 2022 World Happiness Report, with some variations (my dataset was for ten years, while the report uses 2019-2021). The top 4 countries remain unchanged…with Finland, Denmark, Iceland and Switzerland capturing the highest spots. Afghanistan remains at the bottom of the list.
Exploratory Analysis – Finding Correlations
To be fair, the above could have just as easily have been done by a quick once-over with the data…or visualizing it in Excel. Time to put Code Interpreter to the test. I uploaded data from the World Bank and asked it to combine the datasets to find correlations…and it worked surprisingly well.
Next, I asked it to create some exploratory visuals:
Sample Visual 1:
Sample Visual 2:
In comparison, here’s what the official report says:
The World Bank dataset provided was limited so it doesn’t capture all the factors, but the most obvious ones like economic prosperity (GDP per Capita) and life expectancy come through pretty well.
Here’s a complete walkthrough video so you can see the process and the outputs:
Pretty darn impressive! I think Code Interpreter may just be my new favourite tool to use with ChatGPT. Not only is it extremely versatile, it also auto corrects input data at times and provides various exploratory data analyses and visualizations. There are still some things that may require exporting code and running separately (e.g. when I asked it for a visual world map showing happiness scores) but with some experience and experimentation that’s easily done too.
Have you played around with Code Interpreter yet? If so, do share tips, tricks and interesting use cases by leaving a comment or DM’ing me.
0 comments on “I Asked ChatGPT To Analyze World Happiness Scores – Here’s What It Had To Say”