How much of the world has access to the internet?
  • AI Chat
  • Code
  • Report
  • Beta
    Spinner

    How Much of the World Has Access to the Internet?

    by Federica Benassi

    # Libraries importation
    import pandas as pd
    import matplotlib.pyplot as plt
    import numpy as np
    import seaborn as sns
    # Data importation
    broadband = pd.read_csv("data/broadband.csv")
    internet = pd.read_csv("data/internet.csv")
    people = pd.read_csv("data/people.csv")

    We want to investigate the usage of internet around the world. To do this, data from The World Bank are used:

    1. the internet dataset contains the share of the entity's population who have used the internet in the last three months by country (or region), from 1990 to 2019;

    2. the people dataset contains the number of people who have used the internet in the last three months for that country, region, or group by country (or region), from 1990 to 2019;

    3. the broadband dataset contains the number of fixed subscriptions to high-speed internet at downstream speeds >= 256 kbit/s for that country, region, or group by country (or region), from 1998 to 2019.

    1. What are the top 5 countries with the highest internet use by population share?

    The dataset is not complete since some countries have not the data up to 2019. Therefore, in order to determine the top 5 countries, the absolute maxima are considered in the 2015-2019 period.

    # Select the period
    years = [2015, 2016, 2017, 2018, 2019]
    
    # Select the maximum value for each country in the selected period
    top_5 = internet.groupby("Entity").max().sort_values("Internet_Usage", ascending = False)[:5]
    
    top_5.head()

    As we can see, the majority of countries with maximum internet usage per population share are Emirates located in the Arabian Peninsula. The only exception holds for Liechtenstein, a very small state in Central Europe whose data are recorded up to 2017. If only 2019 data were considered, Liechtenstein would be replaced by Denmark.

    2. How many people had internet access in those countries in 2019?

    # Save the previously found countries in a list
    countries = top_5.Code.to_list()
    
    # How many users each top5 country had in 2019
    people.loc[people.Year == 2019].loc[people.Code.isin(countries)].sort_values("Users")

    As said before, 2019 data for internet usage in Liechtenstein were absent. We can see that the countries with higher internet usage per population share also have a smaller number of users.

    3. What are the top 5 countries with the highest internet use for some world regions?

    Internet usage is investigated for different world regions. The official subdivision and distribution file of the countries by The World Bank can be found here. As done before, the absolute maximum over the period 2015-2019 is taken for each country in order to solve the absence of 2019 data.

    # Requested regions
    regions = ["Middle East & North Africa", "Latin America & Carribean", "East Asia & Pacific", "South Asia", "North America", "Europe & Central Asia"]
    
    # Upload of the file
    countries_by_region = pd.read_csv("data/countries_by_region.csv", sep = ";", 
                            usecols = ["Country Name", "Country ISO3", "Region"])
    
    # Renaming the dataset in order to match the original columns
    countries_by_region.columns = ["Entity", "Code", "Region"]
    
    # Merging of the datasets
    internet_with_regions = pd.merge(internet, countries_by_region)
    def top5(region, dataset = internet_with_regions):
        """ Identification of the top 5 countries for each region requested """
        # Selection of the period
        years = [2015, 2016, 2017, 2018, 2019]
        # Top 5 countries in that period
        countries = dataset.loc[(dataset.Year.isin(years)) & 
                                (dataset.Region == region)] \
                           .groupby("Entity") \
                           .max() \
                           .sort_values("Internet_Usage", ascending = False)
    
        return countries[:5]