The GeoInformationWorld class

GeoInformationWorld class documentation#

This class can be used to handle GeoIDs in both ISO 3166 alpha_2 and ISO 3166 alpha_3 versions. It also provides country name, continent and population information. The class will load the GeoInformationWorld.csv file that exist in the data directory of the Covid-19-Analysis repository. Create an instance of the file in a try-catch block as it might raise a FileNotFoundErrorexception if it can’t load the file.
This are the methods provided by the class:

def __init__(self):

The constructor loads the CSV file with the geo information of the countries of the world.
ATTENTION: The GeoID and alpha-2 of Nambia would be ‘NA’ but the Pandas csv reader makes a NaN out of it. Therefore we use NAM as the alpha-2.
Raises: FileNotFoundError In case it couldn’t download the file

def get_geo_information_world(self):

Returns the DataFrame of information of all countries such as country name, continent, population etc..
Returns: information (DataFrame)

def geo_name_from_geoid (self, geoID):

Return the name of a country of the internal geo information from a given ISO 3166 alpha_2 geoid.
Args: geoID (str): a string of a ISO-3166-alpha_2 geoid
Returns: countryName (str)

def geo_name_from_ISO3166_alpha_3 (self, geoID):

Returns the name of a country of the internal geo information from a given ISO 3166 alpha_3 geoid.
Args: geoID (str): a string of a ISO 3166 alpha_3 geoid
Returns: countryName (str)

def geoID_from_ISO3166_alpha_3 (self, geoID):

Returns the ISO 3166 alpha_2 geoid of a country of the internal geo information from a given ISO 3166 alpha_3 geoid.
Args: geoID (str): a string of a ISO 3166 alpha_3 geoid
Returns: ISO 3166 alpha_2 geoid (str)

def ISO3166_alpha_3_from_geoID (self, geoID):

Returns the ISO 3166 alpha_3 geoid of a country of the internal geo information from a given ISO-3166-alpha_2 geoid.
Args: geoID (str): a string of a ISO 3166 alpha_2 geoid
Returns: the ISO 3166 alpha_3 geoid (str)

def population_from_geoid(self, geoID):

Returns the population of a country of the internal geo information from a given ISO-3166-alpha_2 geoid.
Args: geoID (str): a string of a ISO 3166 alpha_2 geoid
Returns: the population of the country (ìnt)

def continent_from_geoid(self, geoID):

Returns the continent of a country of the internal geo information from a given ISO-3166-alpha_2 geoid.
Args: geoID (str): a string of a ISO 3166 alpha_2 geoid
Returns: the continent of the country (str)