Skip to content

World Population Data

This dataset has the total population numbers for every country from 1960 to 2020. Additionally, there is a table that contains country information, including region, income group, and any special notes.

Not sure where to begin? Scroll to the bottom to find challenges!

import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import plotly.express as px
mdf = pd.read_csv('metadata_country.csv')
df = pd.read_csv('world_pop_data.csv')
display(mdf.head())
display(df.head())

Source and license of dataset.

You are working for a regional organization in East Asia and the Pacific that analyzes population statistics and makes recommendations to relevant governments. There are concerns that some countries in the region are experiencing a decline in populations.

Your manager has asked you to prepare a population forecast for the region for 5, 10, and 15 years into the future. They have also asked you to identify the five countries with the lowest population growth (or greatest decline), and perform similar forecasts for these five countries individually.

You will need to prepare a report that is accessible to a broad audience. It should outline your motivation, steps, findings, and conclusions.

country_code_list = mdf[mdf['Region'] == "East Asia & Pacific"]['Country Code']
east_df = df[df['Country Code'].isin(country_code_list)]
east_df
# creating a % growth column
east_df['Percent Growth'] = (east_df['2020'] / east_df['1960']) * 100
east_df.head()
# east_df[['Percent Growth','Country Code']].sort_values('Percent Growth')
east_df.sort_values('Percent Growth')
pop_by_year_df = df.melt(id_vars=['Country Code', 'Indicator Name', 'Indicator Code'],var_name='Year',value_name='Total Population')
pop_by_year_df.head()
fig = px.choropleth(
    pop_by_year_df,locations='Country Code', color='Total Population',
    # range_color =[0,df[df['Country Code'] == 'CHN']['2020'].max()],
    range_color =[0,700000000],
    hover_name="Country Code",
    animation_frame='Year'
)
_ = fig.update_layout(title_text='World Population During 2020')
fig.show()