Autor: Antonio de Jesus Anaya Hernandez, DevOps eng. for the IoPA.
Autor: The internet of Production Alliance, 2023.
Data was collected by "Fab Foundation", location: https://api.fablabs.io/0/labs.json
The Open Know Where (OKW) Standard is part of the Internet of Production Alliance and its members.
License: CC BY SA
Python code used to download, parse, filter, sort and map the data:
import folium
from folium.plugins import HeatMap
import requests
import pandas as pd
import matplotlib.pyplot as plt
url = "https://api.fablabs.io/0/labs.json"
response = requests.get(url)
data = response.json()
df = pd.DataFrame(data)
df = df[df['activity_status'] == 'active']
df = df.drop(columns=['id', 'kind_name', 'parent_id', 'blurb', 'description', 'slug', 'avatar_url', 'header_url'])
african_countries = {
"DZ": "Algeria",
"AO": "Angola",
"BJ": "Benin",
"BW": "Botswana",
"BF": "Burkina Faso",
"BI": "Burundi",
"CM": "Cameroon",
"CV": "Cape Verde",
"CF": "Central African Republic",
"TD": "Chad",
"KM": "Comoros",
"CG": "Congo",
"CD": "Democratic Republic of the Congo",
"CI": "Côte d'Ivoire",
"DJ": "Djibouti",
"EG": "Egypt",
"GQ": "Equatorial Guinea",
"ER": "Eritrea",
"ET": "Ethiopia",
"GA": "Gabon",
"GM": "Gambia",
"GH": "Ghana",
"GN": "Guinea",
"GW": "Guinea-Bissau",
"KE": "Kenya",
"LS": "Lesotho",
"LR": "Liberia",
"LY": "Libya",
"MG": "Madagascar",
"MW": "Malawi",
"ML": "Mali",
"MR": "Mauritania",
"MU": "Mauritius",
"YT": "Mayotte",
"MA": "Morocco",
"MZ": "Mozambique",
"NA": "Namibia",
"NE": "Niger",
"NG": "Nigeria",
"RW": "Rwanda",
"RE": "Réunion",
"SH": "Saint Helena",
"ST": "São Tomé and Principe",
"SN": "Senegal",
"SC": "Seychelles",
"SL": "Sierra Leone",
"SO": "Somalia",
"ZA": "South Africa",
"SS": "South Sudan",
"SD": "Sudan",
"SZ": "Swaziland",
"TZ": "Tanzania",
"TG": "Togo",
"TN": "Tunisia",
"UG": "Uganda",
"EH": "Western Sahara",
"ZM": "Zambia",
"ZW": "Zimbabwe"
}
africa_codes = african_countries.keys()
df = df[df['country_code'].isin(africa_codes)]
df = df[df['phone'].notna() & df['email'].notna() & (df['phone'] != '') & (df['email'] != '')]
df = df[df['latitude'].notna() & df['longitude'].notna() & (df['latitude'] != '') & (df['longitude'] != '')]
df.to_csv('make_african_countries.csv', index=False)
avg_lat = df['latitude'].mean()
avg_lon = df['longitude'].mean()
map = folium.Map(location=[avg_lat, avg_lon], zoom_start=3)
HeatMap(data=df[['latitude', 'longitude']].values, radius=8, max_zoom=7).add_to(map)
<folium.plugins.heat_map.HeatMap at 0x1bcdae040d0>
map
df['country_name'] = df['country_code'].map(african_countries)
result = df.groupby('country_name').size().sort_values(ascending=True)
result.plot(kind='barh', rot=0, width=0.3, align='center', figsize=(15,12))
plt.xlabel("count")
plt.ylabel("Country")
Text(0, 0.5, 'Country')
result
country_name Benin 1 Burkina Faso 1 Chad 1 Côte d'Ivoire 1 Democratic Republic of the Congo 1 Djibouti 1 South Africa 1 Madagascar 1 Mali 1 Rwanda 1 Senegal 2 Réunion 2 Kenya 2 Libya 3 Morocco 3 Cameroon 3 Tunisia 3 Nigeria 4 Egypt 16 dtype: int64
print("Countries:\t" + str(result.shape[0]) + " \nTotal fablabs:\t" + str(result.sum()))
Countries: 19 Total fablabs: 48