Skip to content
Competition - XP Competition 2022
How Much of the World Has Access to the Internet?
# Import libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
#Defining the size of the figures
plt.rcParams["figure.figsize"] = (11,4)
# Read the data
broadband = pd.read_csv('data/broadband.csv')
people = pd.read_csv('data/people.csv')
internet = pd.read_csv('data/internet.csv')broadband.head()people.head()internet.head()How Much of the World Has Access to the Internet?
Now let's now move on to the competition and challenge.
๐ Background
You work for a policy consulting firm. One of the firm's principals is preparing to give a presentation on the state of internet access in the world. She needs your help answering some questions about internet accessibility across the world.
๐พ The data
The research team compiled the following tables (source):
internet
- "Entity" - The name of the country, region, or group.
 - "Code" - Unique id for the country (null for other entities).
 - "Year" - Year from 1990 to 2019.
 - "Internet_usage" - The share of the entity's population who have used the internet in the last three months.
 
people
- "Entity" - The name of the country, region, or group.
 - "Code" - Unique id for the country (null for other entities).
 - "Year" - Year from 1990 to 2020.
 - "Users" - The number of people who have used the internet in the last three months for that country, region, or group.
 
broadband
- "Entity" - The name of the country, region, or group.
 - "Code" - Unique id for the country (null for other entities).
 - "Year" - Year from 1998 to 2020.
 - "Broadband_Subscriptions" - The number of fixed subscriptions to high-speed internet at downstream speeds >= 256 kbit/s for that country, region, or group.
 
Acknowledgments: Max Roser, Hannah Ritchie, and Esteban Ortiz-Ospina (2015) - "Internet." OurWorldInData.org.
len(broadband)๐ช Challenge
Create a report to answer the principal's questions. Include:
- What are the top 5 countries with the highest internet use (by population share)?
 - How many people had internet access in those countries in 2019?
 - What are the top 5 countries with the highest internet use for each of the following regions: 'Africa Eastern and Southern', 'Africa Western and Central', 'Latin America & Caribbean', 'East Asia & Pacific', 'South Asia', 'North America', 'European Union'?
 - Create a visualization for those five regions' internet usage over time.
 - What are the 5 countries with the most internet users?
 - What is the correlation between internet usage (population share) and broadband subscriptions for 2019?
 - Summarize your findings.
 
- What are the top 5 countries with the highest internet use (by population share)?
 
#Filtering only by country (with Code) and Year is 2019
val = (~internet['Code'].isin([np.nan,'OWID_WRL']))&(internet['Year']==2019)
users_by_country_top_5 = internet[val].sort_values('Internet_Usage', ascending=False)[:5]
users_by_country_top_5.set_index('Entity',drop=True, inplace=True)
users_by_country_top_5#Filtering only by country (with Code) and Year is 2019
users_by_country_top_5['Internet_Usage'].plot(kind='bar')
#Defining the title
plt.title('Top 5 countries with the highest internet use')
#Defining the x and y labels
plt.xlabel('Country')
plt.ylabel('Internet_Usage (%)')
#Showing the graph
plt.show()- How many people had internet access in those countries in 2019?
 
#Filtering only by country (with Code) and year is 2019
val = (~people['Code'].isin([np.nan,'OWID_WRL']))&(people['Year']==2019)&(people['Entity'].isin(users_by_country_top_5.index.tolist()))
users_by_country_top_5 = people[val].sort_values('Users', ascending=False)[:5]
users_by_country_top_5.set_index('Entity',drop=True, inplace=True)
users_by_country_top_5#Filtering only by country (with Code) and year is 2019
users_by_country_top_5['Users'].plot(kind='bar')
#Defining the title
plt.title('People with internet access in Top 5-countries with the highest internet use')
#Defining the x and y labels
plt.xlabel('Country')
plt.ylabel('Number of users')
#Showing the graph
plt.show()โ
โ
โ
โ
โ