Gini index

Source: worldbank.org, 01.09.2025

Year: 2023

Flag Country Value Value change, % Rank
Argentina Argentina 42.4 +4.18% 9
Armenia Armenia 27.2 -2.51% 24
Bolivia Bolivia 42.1 +2.18% 10
Brazil Brazil 51.6 -0.769% 2
Colombia Colombia 53.9 -1.64% 1
Costa Rica Costa Rica 46.7 -1.06% 5
Dominican Republic Dominican Republic 38.4 +3.78% 16
Ecuador Ecuador 44.6 -1.98% 7
Georgia Georgia 34.8 +3.88% 20
Guatemala Guatemala 45.2 -6.42% 6
Honduras Honduras 46.8 -2.9% 4
Indonesia Indonesia 36.1 +1.69% 18
Iran Iran 35.9 +3.16% 19
Iraq Iraq 29.8 +1.02% 23
Panama Panama 48.9 -3.93% 3
Peru Peru 40.7 +0.993% 13
Philippines Philippines 39.3 -3.44% 15
Paraguay Paraguay 44.4 -0.893% 8
Palestinian Territories Palestinian Territories 36.4 +8.01% 17
El Salvador El Salvador 39.8 +2.58% 14
Thailand Thailand 33.5 -2.33% 22
Uruguay Uruguay 40.9 +0.739% 12
United States United States 41.8 +0.24% 11
Uzbekistan Uzbekistan 34.5 +10.6% 21

The Gini index, also known as the Gini coefficient, is a statistical measure that represents income or wealth distribution within a population. Its value ranges from 0 to 100, where 0 indicates perfect equality (everyone has the same income) and 100 indicates perfect inequality (one person has all the income, while everyone else has none). Developed by the Italian statistician Corrado Gini, this index serves as an essential tool for economists and policymakers to assess economic inequality within and across countries.

The importance of the Gini index cannot be overstated. It provides insights into the socio-economic conditions of a region, allowing for the identification of disparities that may lead to social unrest or economic instability. Policymakers utilize the Gini index not only to understand income distribution but also to inform tax policies, welfare programs, and economic reforms aimed at promoting more equitable growth. By monitoring changes in the Gini coefficient over time, authorities can evaluate the effectiveness of their policies and initiatives aimed at reducing inequality.

The Gini index is closely related to other indicators that reflect economic health and development. For instance, it often correlates with the Human Development Index (HDI), which combines indicators of life expectancy, education, and per capita income. A higher Gini index may indicate lower HDI ratings, suggesting that as income inequality increases, overall quality of life and access to opportunities may decrease as well. Furthermore, the Gini index can be compared with poverty rates—countries with higher income inequality may experience higher rates of poverty, especially among marginalized communities who have limited access to resources.

Several factors can affect the Gini index, including economic policies, labor market dynamics, and global economic trends. For example, taxation policies that focus on progressive taxation can lead to a decrease in the Gini index by redistributing wealth more equitably. Additionally, access to quality education and vocational training can enhance opportunities for lower-income individuals, thereby promoting greater income equality. Conversely, factors such as economic globalization and technological advancements can exacerbate income inequities by disproportionately benefiting certain sectors while leaving vulnerable workers behind.

Strategies to reduce the Gini index include implementing social safety nets, increasing access to quality education, and fostering job creation in underprivileged areas. Governments might also consider adopting inclusive economic policies that support entrepreneurship and skills development, aiming to elevate the economic participation of lower-income groups. Furthermore, promoting workers' rights and ensuring living wages can contribute to a more balanced income distribution within the labor force. Collaborative efforts among governments, businesses, and civil society organizations can enhance these strategies by creating synergies that address the multifaceted nature of income inequality.

While the Gini index is a valuable tool for measuring economic inequality, it does have its flaws. One major limitation is that it does not capture the overall wealth distribution or the impact of amassed wealth; it focuses solely on income, potentially obscuring important factors such as asset ownership or access to resources. Additionally, the Gini index may not adequately reflect regional disparities within a country, where local variations in income can be vast. Accordingly, while the Gini index offers important insights into income distribution and inequality, it should be supplemented with other measures and indicators to provide a more comprehensive view of economic well-being.

In 2023, the median Gini index value reached 45.65, indicating a significant degree of income inequality in the global landscape. When examining specific regions, we find that Panama reported a Gini index of 48.9, categorizing it as the highest inequality area among the top contenders in this measurement. Following closely, Costa Rica and Ecuador registered Gini indices of 46.7 and 44.6, respectively. These values suggest that the income distribution in these areas is skewed, with a significant gap between the wealthy minority and the economically disadvantaged majority.

Interestingly, Indonesia stands as an outlier, appearing in both the top and bottom categories with a Gini index of 36.1. This duality suggests that while certain regions within Indonesia may experience favorable income distribution, others are facing substantial economic disparity, illustrating the complexity of income inequality within the country.

By understanding the Gini index and its implications, economic stakeholders can better navigate the challenges of inequality. It serves as a call to action for nations to address the root causes of inequality through targeted policies and reforms. Ultimately, bridging the gap towards a more equitable society requires a comprehensive approach that considers economic, social, and political dimensions—ensuring that the benefits of growth are shared more broadly across all segments of society.

                    
# Install missing packages
import sys
import subprocess

def install(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package])

# Required packages
for package in ['wbdata', 'country_converter']:
try:
__import__(package)
except ImportError:
install(package)

# Import libraries
import wbdata
import country_converter as coco
from datetime import datetime

# Define World Bank indicator code
dataset_code = 'SI.POV.GINI'

# Download data from World Bank API
data = wbdata.get_dataframe({dataset_code: 'value'},
date=(datetime(1960, 1, 1), datetime.today()),
parse_dates=True,
keep_levels=True).reset_index()

# Extract year
data['year'] = data['date'].dt.year

# Convert country names to ISO codes using country_converter
cc = coco.CountryConverter()
data['iso2c'] = cc.convert(names=data['country'], to='ISO2', not_found=None)
data['iso3c'] = cc.convert(names=data['country'], to='ISO3', not_found=None)

# Filter out rows where ISO codes could not be matched — likely not real countries
data = data[data['iso2c'].notna() & data['iso3c'].notna()]

# Sort for calculation
data = data.sort_values(['iso3c', 'year'])

# Calculate YoY absolute and percent change
data['value_change'] = data.groupby('iso3c')['value'].diff()
data['value_change_percent'] = data.groupby('iso3c')['value'].pct_change() * 100

# Calculate ranks (higher GDP per capita = better rank)
data['rank'] = data.groupby('year')['value'].rank(ascending=False, method='dense')

# Calculate rank change from previous year
data['rank_change'] = data.groupby('iso3c')['rank'].diff()

# Select desired columns
final_df = data[['country', 'iso2c', 'iso3c', 'year', 'value',
'value_change', 'value_change_percent', 'rank', 'rank_change']].copy()

# Optional: Add labels as metadata (could be useful for export or UI)
column_labels = {
'country': 'Country name',
'iso2c': 'ISO 2-letter country code',
'iso3c': 'ISO 3-letter country code',
'year': 'Year',
'value': 'GDP per capita (current US$)',
'value_change': 'Year-over-Year change in value',
'value_change_percent': 'Year-over-Year percent change in value',
'rank': 'Country rank by GDP per capita (higher = richer)',
'rank_change': 'Change in rank from previous year'
}

# Display first few rows
print(final_df.head(10))

# Optional: Save to CSV
#final_df.to_csv("gdp_per_capita_cleaned.csv", index=False)
                    
                
                    
# Check and install required packages
required_packages <- c("WDI", "countrycode", "dplyr")

for (pkg in required_packages) {
  if (!requireNamespace(pkg, quietly = TRUE)) {
    install.packages(pkg)
  }
}

# Load the necessary libraries
library(WDI)
library(dplyr)
library(countrycode)

# Define the dataset code (World Bank indicator code)
dataset_code <- 'SI.POV.GINI'

# Download data using WDI package
dat <- WDI(indicator = dataset_code)

# Filter only countries using 'is_country' from countrycode
# This uses iso2c to identify whether the entry is a recognized country
dat <- dat %>%
  filter(countrycode(iso2c, origin = 'iso2c', destination = 'country.name', warn = FALSE) %in%
           countrycode::codelist$country.name.en)

# Ensure dataset is ordered by country and year
dat <- dat %>%
  arrange(iso3c, year)

# Rename the dataset_code column to "value" for easier manipulation
dat <- dat %>%
  rename(value = !!dataset_code)

# Calculate year-over-year (YoY) change and percentage change
dat <- dat %>%
  group_by(iso3c) %>%
  mutate(
    value_change = value - lag(value),                              # Absolute change from previous year
    value_change_percent = 100 * (value - lag(value)) / lag(value) # Percent change from previous year
  ) %>%
  ungroup()

# Calculate rank by year (higher value => higher rank)
dat <- dat %>%
  group_by(year) %>%
  mutate(rank = dense_rank(desc(value))) %>% # Rank countries by descending value
  ungroup()

# Calculate rank change (positive = moved up, negative = moved down)
dat <- dat %>%
  group_by(iso3c) %>%
  mutate(rank_change = rank - lag(rank)) %>% # Change in rank compared to previous year
  ungroup()

# Select and reorder final columns
final_data <- dat %>%
  select(
    country,
    iso2c,
    iso3c,
    year,
    value,
    value_change,
    value_change_percent,
    rank,
    rank_change
  )

# Add labels (variable descriptions)
attr(final_data$country, "label") <- "Country name"
attr(final_data$iso2c, "label") <- "ISO 2-letter country code"
attr(final_data$iso3c, "label") <- "ISO 3-letter country code"
attr(final_data$year, "label") <- "Year"
attr(final_data$value, "label") <- "GDP per capita (current US$)"
attr(final_data$value_change, "label") <- "Year-over-Year change in value"
attr(final_data$value_change_percent, "label") <- "Year-over-Year percent change in value"
attr(final_data$rank, "label") <- "Country rank by GDP per capita (higher = richer)"
attr(final_data$rank_change, "label") <- "Change in rank from previous year"

# Print the first few rows of the final dataset
print(head(final_data, 10))