Contents

Callysto.ca Banner

Open in Callysto

Gapminder Data

Gapminder is an organization that promotes use and understanding of statistics about social, economic, and environmental development.

Most Gapminder data is available in online spreadsheets accessed from the sourceLink on the data page.

For example if the data are at docs.google.com/spreadsheets/d/11mulzUH3_cueq-V9D5KIlo9oHE9YYZrUSeVyCin7_rM/edit#gid=176703676 then you copy the spreadsheet key (11mulzUH3_cueq-V9D5KIlo9oHE9YYZrUSeVyCin7_rM) and GID (176703676) and replace the values in the code cell.

Life Expectancy

spreadsheet_key = '11mulzUH3_cueq-V9D5KIlo9oHE9YYZrUSeVyCin7_rM'
spreadsheet_gid = '176703676'

import pandas as pd
csv_link = 'https://docs.google.com/spreadsheets/d/'+spreadsheet_key+'/export?gid='+spreadsheet_gid+'&format=csv'
df = pd.read_csv(csv_link)
df
geo name time Life expectancy
0 afg Afghanistan 1800 28.21
1 afg Afghanistan 1801 28.20
2 afg Afghanistan 1802 28.19
3 afg Afghanistan 1803 28.18
4 afg Afghanistan 1804 28.17
... ... ... ... ...
56125 zwe Zimbabwe 2096 75.12
56126 zwe Zimbabwe 2097 75.25
56127 zwe Zimbabwe 2098 75.38
56128 zwe Zimbabwe 2099 75.52
56129 zwe Zimbabwe 2100 75.65

56130 rows × 4 columns

Current Populations

If you are interested in the current populations of countries, you can use the following code.

pop_csv_url = 'https://docs.google.com/spreadsheets/d/18Ep3s1S0cvlT1ovQG9KdipLEoQ1Ktz5LtTTQpDcWbX0/export?gid=1668956939&format=csv'

import pandas as pd
populations = pd.read_csv(pop_csv_url)
current_populations = populations[populations['time']==2019]
current_populations
geo name time population
219 afg Afghanistan 2019 37209007
520 alb Albania 2019 2938428
821 dza Algeria 2019 42679018
1122 and Andorra 2019 77072
1423 ago Angola 2019 31787566
... ... ... ... ...
58011 vnm Vietnam 2019 97429061
58312 yem Yemen 2019 29579986
58613 zmb Zambia 2019 18137369
58914 zwe Zimbabwe 2019 17297495
59215 ssd South Sudan 2019 13263184

197 rows × 4 columns

Callysto.ca License