diff --git a/defaults/population_weights.tsv b/defaults/population_weights.tsv index a1b3b94ca..d7d4378af 100644 --- a/defaults/population_weights.tsv +++ b/defaults/population_weights.tsv @@ -1,240 +1,240 @@ # [DO NOT EDIT] This file was generated by scripts/developer_scripts/get_population_weights -# Last updated on 2024-08-06 +# Based on 2023 population estimates from the United Nations World Population Prospects country weight -Burundi 13689 -Union of the Comoros 850 -Djibouti 1152 -Eritrea 3470 -Ethiopia 128691 -Kenya 55339 -Madagascar 31195 -Malawi 21104 -Mauritius 1273 -Mayotte 316 -Mozambique 33635 -Réunion 874 -Rwanda 13954 -Seychelles 127 -Somalia 18358 -South Sudan 11483 -Uganda 48656 -Tanzania 66617 -Zambia 20723 -Zimbabwe 16340 -Angola 36749 -Cameroon 28372 -Central African Republic 5152 -Chad 19319 -Republic of the Congo 6182 -Democratic Republic of the Congo 105789 -Equatorial Guinea 1847 -Gabon 2484 -Sao Tome and Principe 230 +Afghanistan 41454 +Albania 2811 Algeria 46164 -Egypt 114535 -Libya 7305 -Morocco 37712 -Sudan 50042 -Tunisia 12200 -Western Sahara 579 -Botswana 2480 -Eswatini 1230 -Lesotho 2311 -Namibia 2963 -South Africa 63212 +American Samoa 47 +Andorra 80 +Angola 36749 +Anguilla 14 +Antigua and Barbuda 93 +Argentina 45538 +Armenia 2943 +Aruba 107 +Australia 26451 +Austria 9130 +Azerbaijan 10318 +Bahamas 399 +Bahrain 1569 +Bangladesh 171466 +Barbados 282 +Belarus 9115 +Belgium 11712 +Belize 411 Benin 14111 +Bermuda 64 +Bhutan 786 +Bolivia 12244 +Bonaire 29 +Bosnia and Herzegovina 3185 +Botswana 2480 +Brazil 211140 +British Virgin Islands 38 +Brunei 458 +Bulgaria 6795 Burkina Faso 23025 +Burundi 13689 Cabo Verde 522 -Côte d'Ivoire 31165 -Gambia 2697 -Ghana 33787 -Guinea 14405 -Guinea-Bissau 2153 -Liberia 5493 -Mali 23769 -Mauritania 5022 -Niger 26159 -Nigeria 227882 -Saint Helena 5 -Senegal 18077 -Sierra Leone 8460 -Togo 9304 -Kazakhstan 20330 -Kyrgyzstan 7073 -Tajikistan 10389 -Turkmenistan 7364 -Uzbekistan 35652 +Cambodia 17423 +Cameroon 28372 +Canada 39299 +Cayman Islands 73 +Central African Republic 5152 +Chad 19319 +Chile 19658 China 1422584 Hong Kong 7442 Macao 713 Taiwan 23317 -Dem. People's Republic of Korea 26418 -Japan 124370 -Mongolia 3431 -South Korea 51748 -Afghanistan 41454 -Bangladesh 171466 -Bhutan 786 -India 1438069 -Iran 90608 -Maldives 525 -Nepal 29694 -Pakistan 247504 -Sri Lanka 22971 -Brunei 458 -Cambodia 17423 -Indonesia 281190 -Laos 7664 -Malaysia 35126 -Myanmar 54133 -Philippines 114891 -Singapore 5789 -Thailand 71702 -Timor-Leste 1384 -Vietnam 100352 -Armenia 2943 -Azerbaijan 10318 -Bahrain 1569 +Colombia 52321 +Union of the Comoros 850 +Republic of the Congo 6182 +Cook Islands 14 +Costa Rica 5105 +Croatia 3896 +Cuba 11019 +Curacao 185 Cyprus 1344 -Georgia 3807 -Iraq 45074 -Israel 9256 -Jordan 11439 -Kuwait 4838 -Lebanon 5773 -Oman 5049 -Qatar 2979 -Saudi Arabia 33264 -Palestine 5409 -Syria 23594 -Turkey 87270 -United Arab Emirates 10642 -Yemen 39390 -Belarus 9115 -Bulgaria 6795 Czech Republic 10809 -Hungary 9686 -Poland 38762 -Moldova 3067 -Romania 19118 -Russia 145440 -Slovakia 5518 -Ukraine 37732 +Côte d'Ivoire 31165 +Dem. People's Republic of Korea 26418 +Democratic Republic of the Congo 105789 Denmark 5948 +Djibouti 1152 +Dominica 66 +Dominican Republic 11331 +Ecuador 17980 +Egypt 114535 +El Salvador 6309 +Equatorial Guinea 1847 +Eritrea 3470 Estonia 1367 +Eswatini 1230 +Ethiopia 128691 +Falkland Islands (Malvinas) 3 Faroe Islands 54 +Fiji 924 Finland 5601 +France 66438 +French Guiana 303 +French Polynesia 281 +Gabon 2484 +Gambia 2697 +Georgia 3807 +Germany 84548 +Ghana 33787 +Gibraltar 38 +Greece 10242 +Greenland 55 +Grenada 117 +Guadeloupe 376 +Guam 166 +Guatemala 18124 Guernsey 64 +Guinea 14405 +Guinea-Bissau 2153 +Guyana 826 +Haiti 11637 +Holy See 0 +Honduras 10644 +Hungary 9686 Iceland 387 +India 1438069 +Indonesia 281190 +Iran 90608 +Iraq 45074 Ireland 5196 Isle of Man 84 +Israel 9256 +Italy 59499 +Jamaica 2839 +Japan 124370 Jersey 103 +Jordan 11439 +Kazakhstan 20330 +Kenya 55339 +Kiribati 132 +Kosovo 1700 +Kuwait 4838 +Kyrgyzstan 7073 +Laos 7664 Latvia 1882 +Lebanon 5773 +Lesotho 2311 +Liberia 5493 +Libya 7305 +Liechtenstein 39 Lithuania 2854 -Norway 5519 -Sweden 10551 -United Kingdom 68682 -Albania 2811 -Andorra 80 -Bosnia and Herzegovina 3185 -Croatia 3896 -Gibraltar 38 -Greece 10242 -Holy See 0 -Italy 59499 -Kosovo 1700 +Luxembourg 665 +Madagascar 31195 +Malawi 21104 +Malaysia 35126 +Maldives 525 +Mali 23769 Malta 532 +Marshall Islands 38 +Martinique 346 +Mauritania 5022 +Mauritius 1273 +Mayotte 316 +Mexico 129739 +Micronesia 112 +Monaco 38 +Mongolia 3431 Montenegro 633 +Montserrat 4 +Morocco 37712 +Mozambique 33635 +Myanmar 54133 +Namibia 2963 +Nauru 11 +Nepal 29694 +Netherlands 18092 +New Caledonia 289 +New Zealand 5172 +Nicaragua 6823 +Niger 26159 +Nigeria 227882 +Niue 1 North Macedonia 1831 +Northern Mariana Islands 45 +Norway 5519 +Oman 5049 +Pakistan 247504 +Palau 17 +Panama 4458 +Papua New Guinea 10389 +Paraguay 6844 +Peru 33845 +Philippines 114891 +Poland 38762 Portugal 10430 -San Marino 33 -Serbia 6773 -Slovenia 2118 -Spain 47911 -Austria 9130 -Belgium 11712 -France 66438 -Germany 84548 -Liechtenstein 39 -Luxembourg 665 -Monaco 38 -Netherlands 18092 -Switzerland 8870 -Anguilla 14 -Antigua and Barbuda 93 -Aruba 107 -Bahamas 399 -Barbados 282 -Bonaire 29 -British Virgin Islands 38 -Cayman Islands 73 -Cuba 11019 -Curacao 185 -Dominica 66 -Dominican Republic 11331 -Grenada 117 -Guadeloupe 376 -Haiti 11637 -Jamaica 2839 -Martinique 346 -Montserrat 4 Puerto Rico 3242 +Qatar 2979 +South Korea 51748 +Moldova 3067 +Romania 19118 +Russia 145440 +Rwanda 13954 +Réunion 874 Saint Barthélemy 11 +Saint Helena 5 Saint Kitts and Nevis 46 Saint Lucia 179 Saint Martin 27 +Saint Pierre and Miquelon 5 Saint Vincent and the Grenadines 101 +Samoa 216 +San Marino 33 +Sao Tome and Principe 230 +Saudi Arabia 33264 +Senegal 18077 +Serbia 6773 +Seychelles 127 +Sierra Leone 8460 +Singapore 5789 Sint Maarten 42 +Slovakia 5518 +Slovenia 2118 +Solomon Islands 800 +Somalia 18358 +South Africa 63212 +South Sudan 11483 +Spain 47911 +Sri Lanka 22971 +Palestine 5409 +Sudan 50042 +Suriname 628 +Sweden 10551 +Switzerland 8870 +Syria 23594 +Tajikistan 10389 +Thailand 71702 +Timor-Leste 1384 +Togo 9304 +Tokelau 2 +Tonga 104 Trinidad and Tobago 1502 +Tunisia 12200 +Turkmenistan 7364 Turks and Caicos Islands 46 +Tuvalu 9 +Turkey 87270 +Uganda 48656 +Ukraine 37732 +United Arab Emirates 10642 +United Kingdom 68682 +Tanzania 66617 United States Virgin Islands 85 -Belize 411 -Costa Rica 5105 -El Salvador 6309 -Guatemala 18124 -Honduras 10644 -Mexico 129739 -Nicaragua 6823 -Panama 4458 -Argentina 45538 -Bolivia 12244 -Brazil 211140 -Chile 19658 -Colombia 52321 -Ecuador 17980 -Falkland Islands (Malvinas) 3 -French Guiana 303 -Guyana 826 -Paraguay 6844 -Peru 33845 -Suriname 628 -Uruguay 3388 -Venezuela 28300 -Bermuda 64 -Canada 39299 -Greenland 55 -Saint Pierre and Miquelon 5 USA 343477 -Australia 26451 -New Zealand 5172 -Fiji 924 -New Caledonia 289 -Papua New Guinea 10389 -Solomon Islands 800 +Uruguay 3388 +Uzbekistan 35652 Vanuatu 320 -Guam 166 -Kiribati 132 -Marshall Islands 38 -Micronesia 112 -Nauru 11 -Northern Mariana Islands 45 -Palau 17 -American Samoa 47 -Cook Islands 14 -French Polynesia 281 -Niue 1 -Samoa 216 -Tokelau 2 -Tonga 104 -Tuvalu 9 +Venezuela 28300 +Vietnam 100352 Wallis and Futuna Islands 11 +Western Sahara 579 +Yemen 39390 +Zambia 20723 +Zimbabwe 16340 diff --git a/scripts/developer_scripts/get_population_weights b/scripts/developer_scripts/get_population_weights index 8a20ea461..5bffdccd3 100755 --- a/scripts/developer_scripts/get_population_weights +++ b/scripts/developer_scripts/get_population_weights @@ -3,7 +3,6 @@ # This script generates a TSV file containing country names and population sizes. import argparse -import datetime import os from pathlib import Path import pandas as pd @@ -20,6 +19,7 @@ def export_population_weights(output): # ³ # csv = Path(os.path.dirname(__file__)) / "data/WPP2024_TotalPopulationBySex.csv.gz" + source = 'the United Nations World Population Prospects' df = pd.read_csv(csv, usecols=['Location', 'LocTypeName', 'Time', 'PopTotal'], dtype='str') @@ -27,7 +27,8 @@ def export_population_weights(output): df = df[df['LocTypeName'] == 'Country/Area'] # Use data from the latest non-forecast year - df = df[df['Time'] == '2023'] + year = '2023' + df = df[df['Time'] == year] # Rename columns to match names in metadata column_name_map = { @@ -39,8 +40,9 @@ def export_population_weights(output): # Keep only the columns used above df = df[column_name_map.values()] - # Set country as index + # Set country as index and sort alphabetically df = df.set_index('country') + df = df.sort_index() # Rename countries to match values in metadata country_name_map = { @@ -83,7 +85,7 @@ def export_population_weights(output): # Export with open(output, 'a') as f: print("# [DO NOT EDIT] This file was generated by scripts/developer_scripts/get_population_weights", file=f) - print(f"# Last updated on {datetime.date.today().strftime('%Y-%m-%d')}", file=f) + print(f"# Based on {year} population estimates from {source}", file=f) df.to_csv(f, index=True, sep='\t')