Sharing is caring!


In an era of data-driven insights, the “World Happiness Report 2013-2023” dataset emerges as a fascinating window into the intricacies of global happiness. With a comprehensive repository of happiness scores, economic indicators, and social factors, this analysis uncovers trends, correlations, and nuanced insights that offer a deeper understanding of well-being across the globe. Join us on this journey as we unravel the secrets behind the world’s happiness tapestry.

Mapping Happiness Over Time: Unveiling the Journey

The first step in this captivating journey is the visualization of happiness trends over the years. Through dynamic line plots, we can witness how happiness scores have evolved, region by region, from 2013 to 2023. This exploration may reveal unexpected shifts and provide vital clues about the interplay between socio-economic dynamics and emotional well-being.



import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# Load the dataset
data = pd.read_csv('world_happiness_report.csv')  # Replace with the actual file name

# Data Exploration
print(data.head())  # Display the first few rows
print(  # Get information about the dataset

# Trends in Happiness Scores
plt.figure(figsize=(10, 6))
sns.lineplot(x='Year', y='Ladder', data=data, ci=None)
plt.title('Trends in Happiness Scores (Ladder)')
plt.ylabel('Happiness Score')

# Correlation Analysis
corr_matrix = data[['Ladder', 'Social Support', 'Freedom', 'Corruption', 'Generosity']].corr()

plt.figure(figsize=(8, 6))
sns.heatmap(corr_matrix, annot=True, cmap='coolwarm')
plt.title('Correlation Heatmap')

# Region-wise Analysis
region_avg_happiness = data.groupby('Region')['Ladder'].mean().sort_values(ascending=False)

plt.figure(figsize=(10, 6))
plt.title('Average Happiness Score by Region')
plt.ylabel('Average Happiness Score')

# Top and Bottom Countries
top_countries = data[data['Year'] == 2023].nlargest(10, 'Ladder')
bottom_countries = data[data['Year'] == 2023].nsmallest(10, 'Ladder')

print('Top 10 Countries:')
print(top_countries[['Country', 'Ladder']])

print('Bottom 10 Countries:')
print(bottom_countries[['Country', 'Ladder']])

Economic Factors Analysis:

# Correlation between happiness and economic indicators
economic_columns = ['Ladder', 'GDP', 'Income', 'Employment']
economic_corr_matrix = data[economic_columns].corr()

plt.figure(figsize=(8, 6))
sns.heatmap(economic_corr_matrix, annot=True, cmap='coolwarm', center=0)
plt.title('Correlation Heatmap of Economic Factors')

Social Support and Health Analysis:

# Correlation between happiness and social support, life expectancy
social_health_columns = ['Ladder', 'Social Support', 'Life Expectancy']
social_health_corr_matrix = data[social_health_columns].corr()

plt.figure(figsize=(8, 6))
sns.heatmap(social_health_corr_matrix, annot=True, cmap='coolwarm', center=0)
plt.title('Correlation Heatmap of Social Support and Health Factors')

Freedom and Governance Analysis:

# Correlation between happiness and freedom, corruption
freedom_corruption_columns = ['Ladder', 'Freedom', 'Corruption']
freedom_corruption_corr_matrix = data[freedom_corruption_columns].corr()

plt.figure(figsize=(8, 6))
sns.heatmap(freedom_corruption_corr_matrix, annot=True, cmap='coolwarm', center=0)
plt.title('Correlation Heatmap of Freedom and Governance Factors')

Generosity and Donations Analysis:

# Correlation between happiness and generosity, donations
generosity_donation_columns = ['Ladder', 'Generosity', 'Donation']
generosity_donation_corr_matrix = data[generosity_donation_columns].corr()

plt.figure(figsize=(8, 6))
sns.heatmap(generosity_donation_corr_matrix, annot=True, cmap='coolwarm', center=0)
plt.title('Correlation Heatmap of Generosity and Donation Factors')

Temporal Analysis:

# Time series analysis of happiness scores
plt.figure(figsize=(12, 6))
sns.lineplot(x='Year', y='Ladder', data=data, ci=None)
plt.title('Happiness Scores Over Time (2013-2023)')
plt.ylabel('Happiness Score')

Comparative Analysis:

# Boxplot of happiness scores for different regions
plt.figure(figsize=(12, 6))
sns.boxplot(x='Region', y='Ladder', data=data)
plt.title('Comparative Analysis of Happiness Scores by Region')
plt.ylabel('Happiness Score')

Threads of Well-being: The Correlation Matrix

Happiness is a multidimensional concept, influenced by various societal facets. The correlation heatmap, a powerful analytical tool, unveils the intricate relationships between happiness scores, social support, freedom, corruption, donation, generosity, positive affect, and negative affect. This dive into the correlation matrix unravels the complex interactions that shape a nation’s overall happiness, offering insights that policymakers and researchers can leverage.

Regions of Radiance: Analyzing Happiness by Geography

The world is a tapestry woven with diverse cultures, economies, and ideologies. Through meticulous analysis, we unravel regions that consistently shine with higher average happiness scores. These insights provide a lens into the unique societal structures and norms that foster happiness and well-being, allowing us to draw lessons from successful regions.

Balancing Emotions: The Dance of Positive and Negative Affect

Emotions form the backbone of human experiences, and understanding their balance can provide profound insights into a nation’s well-being. Through scatter plots, we examine how positive and negative affect interact, painting a vivid picture of emotional dynamics and prompting reflections on how countries manage their collective emotional palette.

Happiness in Focus: Identifying Leading and Lagging Nations

The pinnacle of our analysis lies in spotlighting the countries that excel in happiness and those facing challenges. With meticulous coding, we identify the top-ranking nations and contrast them with those that have work to do. These observations present a unique opportunity to learn from countries that have cracked the happiness code, fostering dialogues on what it takes to build prosperous and content societies.


In a world that demands insights for shaping policies, fostering well-being, and understanding societal health, the “World Happiness Report 2013-2023” dataset stands as an invaluable resource. Through an exploration of trends, correlations, regional dynamics, and emotional nuances, we have illuminated the path to understanding global happiness. As data enthusiasts and seekers of brighter futures, we embark on this exploration with an unwavering quest to decode the elements that make our world a happier place for all.


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *