Skip to content

Instantly share code, notes, and snippets.

@thomasthaddeus
Created August 9, 2023 15:19
Show Gist options
  • Save thomasthaddeus/2abae66acefa119881da9236cd7cdb23 to your computer and use it in GitHub Desktop.
Save thomasthaddeus/2abae66acefa119881da9236cd7cdb23 to your computer and use it in GitHub Desktop.
Name Landmass Zone Area Population Language Religion Bars Stripes Colors Red Green Blue Gold White Black Orange Mainhue Circles Crosses Saltires Quarters Sunstars Crescent Triangle Icon Animate Text Topleft Botright
Afghanistan 5 1 648 16 10 2 0 3 5 1 1 0 1 1 1 0 green 0 0 0 0 1 0 0 1 0 0 black green
Albania 3 1 29 3 6 6 0 0 3 1 0 0 1 0 1 0 red 0 0 0 0 1 0 0 0 1 0 red red
Algeria 4 1 2388 20 8 2 2 0 3 1 1 0 0 1 0 0 green 0 0 0 0 1 1 0 0 0 0 green white
American-Samoa 6 3 0 0 1 1 0 0 5 1 0 1 1 1 0 1 blue 0 0 0 0 0 0 1 1 1 0 blue red
Andorra 3 1 0 0 6 0 3 0 3 1 0 1 1 0 0 0 gold 0 0 0 0 0 0 0 0 0 0 blue red
Angola 4 2 1247 7 10 5 0 2 3 1 0 0 1 0 1 0 red 0 0 0 0 1 0 0 1 0 0 red black
Anguilla 1 4 0 0 1 1 0 1 3 0 0 1 0 1 0 1 white 0 0 0 0 0 0 0 0 1 0 white blue
Antigua-Barbuda 1 4 0 0 1 1 0 1 5 1 0 1 1 1 1 0 red 0 0 0 0 1 0 1 0 0 0 black red
Argentina 2 3 2777 28 2 0 0 3 2 0 0 1 0 1 0 0 blue 0 0 0 0 0 0 0 0 0 0 blue blue
Argentine 2 3 2777 28 2 0 0 3 3 0 0 1 1 1 0 0 blue 0 0 0 0 1 0 0 0 0 0 blue blue
Australia 6 2 7690 15 1 1 0 0 3 1 0 1 0 1 0 0 blue 0 1 1 1 6 0 0 0 0 0 white blue
Austria 3 1 84 8 4 0 0 3 2 1 0 0 0 1 0 0 red 0 0 0 0 0 0 0 0 0 0 red red
Bahamas 1 4 19 0 1 1 0 3 3 0 0 1 1 0 1 0 blue 0 0 0 0 0 0 1 0 0 0 blue blue
Bahrain 5 1 1 0 8 2 0 0 2 1 0 0 0 1 0 0 red 0 0 0 0 0 0 0 0 0 0 white red
Bangladesh 5 1 143 90 6 2 0 0 2 1 1 0 0 0 0 0 green 1 0 0 0 0 0 0 0 0 0 green green
Barbados 1 4 0 0 1 1 3 0 3 0 0 1 1 0 1 0 blue 0 0 0 0 0 0 0 1 0 0 blue blue
Belgium 3 1 31 10 6 0 3 0 3 1 0 0 1 0 1 0 gold 0 0 0 0 0 0 0 0 0 0 black red
Belize 1 4 23 0 1 1 0 2 8 1 1 1 1 1 1 1 blue 1 0 0 0 0 0 0 1 1 1 red red
Benin 4 1 113 3 3 5 0 0 2 1 1 0 0 0 0 0 green 0 0 0 0 1 0 0 0 0 0 green green
Bermuda 1 4 0 0 1 1 0 0 6 1 1 1 1 1 1 0 red 1 1 1 1 0 0 0 1 1 0 white red
Bhutan 5 1 47 1 10 3 0 0 4 1 0 0 0 1 1 1 orange 4 0 0 0 0 0 0 0 1 0 orange red
Bolivia 2 3 1099 6 2 0 0 3 3 1 1 0 1 0 0 0 red 0 0 0 0 0 0 0 0 0 0 red green
Botswana 4 2 600 1 10 5 0 5 3 0 0 1 0 1 1 0 blue 0 0 0 0 0 0 0 0 0 0 blue blue
Brazil 2 3 8512 119 6 0 0 0 4 0 1 1 1 1 0 0 green 1 0 0 0 22 0 0 0 0 1 green green
British-Virgin-Isles 1 4 0 0 1 1 0 0 6 1 1 1 1 1 0 1 blue 0 1 1 1 0 0 0 1 1 1 white blue
Brunei 5 1 6 0 10 2 0 0 4 1 0 0 1 1 1 0 gold 0 0 0 0 0 0 1 1 1 1 white gold
Bulgaria 3 1 111 9 5 6 0 3 5 1 1 1 1 1 0 0 red 0 0 0 0 1 0 0 1 1 0 white red
Burkina 4 4 274 7 3 5 0 2 3 1 1 0 1 0 0 0 red 0 0 0 0 1 0 0 0 0 0 red green
Burma 5 1 678 35 10 3 0 0 3 1 0 1 0 1 0 0 red 0 0 0 1 14 0 0 1 1 0 blue red
Burundi 4 2 28 4 10 5 0 0 3 1 1 0 0 1 0 0 red 1 0 1 0 3 0 0 0 0 0 white white
Cameroon 4 1 474 8 3 1 3 0 3 1 1 0 1 0 0 0 gold 0 0 0 0 1 0 0 0 0 0 green gold
Canada 1 4 9976 24 1 1 2 0 2 1 0 0 0 1 0 0 red 0 0 0 0 0 0 0 0 1 0 red red
Cape-Verde-Islands 4 4 4 0 6 0 1 2 5 1 1 0 1 0 1 1 gold 0 0 0 0 1 0 0 0 1 0 red green
Cayman-Islands 1 4 0 0 1 1 0 0 6 1 1 1 1 1 0 1 blue 1 1 1 1 4 0 0 1 1 1 white blue
Central-African-Republic 4 1 623 2 10 5 1 0 5 1 1 1 1 1 0 0 gold 0 0 0 0 1 0 0 0 0 0 blue gold
Chad 4 1 1284 4 3 5 3 0 3 1 0 1 1 0 0 0 gold 0 0 0 0 0 0 0 0 0 0 blue red
Chile 2 3 757 11 2 0 0 2 3 1 0 1 0 1 0 0 red 0 0 0 1 1 0 0 0 0 0 blue red
China 5 1 9561 1008 7 6 0 0 2 1 0 0 1 0 0 0 red 0 0 0 0 5 0 0 0 0 0 red red
Colombia 2 4 1139 28 2 0 0 3 3 1 0 1 1 0 0 0 gold 0 0 0 0 0 0 0 0 0 0 gold red
Comorro-Islands 4 2 2 0 3 2 0 0 2 0 1 0 0 1 0 0 green 0 0 0 0 4 1 0 0 0 0 green green
Congo 4 2 342 2 10 5 0 0 3 1 1 0 1 0 0 0 red 0 0 0 0 1 0 0 1 1 0 red red
Cook-Islands 6 3 0 0 1 1 0 0 4 1 0 1 0 1 0 0 blue 1 1 1 1 15 0 0 0 0 0 white blue
Costa-Rica 1 4 51 2 2 0 0 5 3 1 0 1 0 1 0 0 blue 0 0 0 0 0 0 0 0 0 0 blue blue
Cuba 1 4 115 10 2 6 0 5 3 1 0 1 0 1 0 0 blue 0 0 0 0 1 0 1 0 0 0 blue blue
Cyprus 3 1 9 1 6 1 0 0 3 0 1 0 1 1 0 0 white 0 0 0 0 0 0 0 1 1 0 white white
Czechoslovakia 3 1 128 15 5 6 0 0 3 1 0 1 0 1 0 0 white 0 0 0 0 0 0 1 0 0 0 white red
Denmark 3 1 43 5 6 1 0 0 2 1 0 0 0 1 0 0 red 0 1 0 0 0 0 0 0 0 0 red red
Djibouti 4 1 22 0 3 2 0 0 4 1 1 1 0 1 0 0 blue 0 0 0 0 1 0 1 0 0 0 white green
Dominica 1 4 0 0 1 1 0 0 6 1 1 1 1 1 1 0 green 1 0 0 0 10 0 0 0 1 0 green green
Dominican-Republic 1 4 49 6 2 0 0 0 3 1 0 1 0 1 0 0 blue 0 1 0 0 0 0 0 0 0 0 blue blue
Ecuador 2 3 284 8 2 0 0 3 3 1 0 1 1 0 0 0 gold 0 0 0 0 0 0 0 0 0 0 gold red
Egypt 4 1 1001 47 8 2 0 3 4 1 0 0 1 1 1 0 black 0 0 0 0 0 0 0 0 1 1 red black
El-Salvador 1 4 21 5 2 0 0 3 2 0 0 1 0 1 0 0 blue 0 0 0 0 0 0 0 0 0 0 blue blue
Equatorial-Guinea 4 1 28 0 10 5 0 3 4 1 1 1 0 1 0 0 green 0 0 0 0 0 0 1 0 0 0 green red
Ethiopia 4 1 1222 31 10 1 0 3 3 1 1 0 1 0 0 0 green 0 0 0 0 0 0 0 0 0 0 green red
Faeroes 3 4 1 0 6 1 0 0 3 1 0 1 0 1 0 0 white 0 1 0 0 0 0 0 0 0 0 white white
Falklands-Malvinas 2 3 12 0 1 1 0 0 6 1 1 1 1 1 0 0 blue 1 1 1 1 0 0 0 1 1 1 white blue
Fiji 6 2 18 1 1 1 0 0 7 1 1 1 1 1 0 1 blue 0 2 1 1 0 0 0 1 1 0 white blue
Finland 3 1 337 5 9 1 0 0 2 0 0 1 0 1 0 0 white 0 1 0 0 0 0 0 0 0 0 white white
France 3 1 547 54 3 0 3 0 3 1 0 1 0 1 0 0 white 0 0 0 0 0 0 0 0 0 0 blue red
French-Guiana 2 4 91 0 3 0 3 0 3 1 0 1 0 1 0 0 white 0 0 0 0 0 0 0 0 0 0 blue red
French-Polynesia 6 3 4 0 3 0 0 3 5 1 0 1 1 1 1 0 red 1 0 0 0 1 0 0 1 0 0 red red
Gabon 4 2 268 1 10 5 0 3 3 0 1 1 1 0 0 0 green 0 0 0 0 0 0 0 0 0 0 green blue
Gambia 4 4 10 1 1 5 0 5 4 1 1 1 0 1 0 0 red 0 0 0 0 0 0 0 0 0 0 red green
Germany-DDR 3 1 108 17 4 6 0 3 3 1 0 0 1 0 1 0 gold 0 0 0 0 0 0 0 1 0 0 black gold
Germany-FRG 3 1 249 61 4 1 0 3 3 1 0 0 1 0 1 0 black 0 0 0 0 0 0 0 0 0 0 black gold
Ghana 4 4 239 14 1 5 0 3 4 1 1 0 1 0 1 0 red 0 0 0 0 1 0 0 0 0 0 red green
Gibraltar 3 4 0 0 1 1 0 1 3 1 0 0 1 1 0 0 white 0 0 0 0 0 0 0 1 0 0 white red
Greece 3 1 132 10 6 1 0 9 2 0 0 1 0 1 0 0 blue 0 1 0 1 0 0 0 0 0 0 blue blue
Greenland 1 4 2176 0 6 1 0 0 2 1 0 0 0 1 0 0 white 1 0 0 0 0 0 0 0 0 0 white red
Grenada 1 4 0 0 1 1 0 0 3 1 1 0 1 0 0 0 gold 1 0 0 0 7 0 1 0 1 0 red red
Guam 6 1 0 0 1 1 0 0 7 1 1 1 1 1 0 1 blue 0 0 0 0 0 0 0 1 1 1 red red
Guatemala 1 4 109 8 2 0 3 0 2 0 0 1 0 1 0 0 blue 0 0 0 0 0 0 0 0 0 0 blue blue
Guinea 4 4 246 6 3 2 3 0 3 1 1 0 1 0 0 0 gold 0 0 0 0 0 0 0 0 0 0 red green
Guinea-Bissau 4 4 36 1 6 5 1 2 4 1 1 0 1 0 1 0 gold 0 0 0 0 1 0 0 0 0 0 red green
Guyana 2 4 215 1 1 4 0 0 5 1 1 0 1 1 1 0 green 0 0 0 0 0 0 1 0 0 0 black green
Haiti 1 4 28 6 3 0 2 0 2 1 0 0 0 0 1 0 black 0 0 0 0 0 0 0 0 0 0 black red
Honduras 1 4 112 4 2 0 0 3 2 0 0 1 0 1 0 0 blue 0 0 0 0 5 0 0 0 0 0 blue blue
Hong-Kong 5 1 1 5 7 3 0 0 6 1 1 1 1 1 0 1 blue 1 1 1 1 0 0 0 1 1 1 white blue
Hungary 3 1 93 11 9 6 0 3 3 1 1 0 0 1 0 0 red 0 0 0 0 0 0 0 0 0 0 red green
Iceland 3 4 103 0 6 1 0 0 3 1 0 1 0 1 0 0 blue 0 1 0 0 0 0 0 0 0 0 blue blue
India 5 1 3268 684 6 4 0 3 4 0 1 1 0 1 0 1 orange 1 0 0 0 0 0 0 1 0 0 orange green
Indonesia 6 2 1904 157 10 2 0 2 2 1 0 0 0 1 0 0 red 0 0 0 0 0 0 0 0 0 0 red white
Iran 5 1 1648 39 6 2 0 3 3 1 1 0 0 1 0 0 red 0 0 0 0 0 0 0 1 0 1 green red
Iraq 5 1 435 14 8 2 0 3 4 1 1 0 0 1 1 0 red 0 0 0 0 3 0 0 0 0 0 red black
Ireland 3 4 70 3 1 0 3 0 3 0 1 0 0 1 0 1 white 0 0 0 0 0 0 0 0 0 0 green orange
Israel 5 1 21 4 10 7 0 2 2 0 0 1 0 1 0 0 white 0 0 0 0 1 0 0 0 0 0 blue blue
Italy 3 1 301 57 6 0 3 0 3 1 1 0 0 1 0 0 white 0 0 0 0 0 0 0 0 0 0 green red
Ivory-Coast 4 4 323 7 3 5 3 0 3 1 1 0 0 1 0 0 white 0 0 0 0 0 0 0 0 0 0 red green
Jamaica 1 4 11 2 1 1 0 0 3 0 1 0 1 0 1 0 green 0 0 1 0 0 0 1 0 0 0 gold gold
Japan 5 1 372 118 9 7 0 0 2 1 0 0 0 1 0 0 white 1 0 0 0 1 0 0 0 0 0 white white
Jordan 5 1 98 2 8 2 0 3 4 1 1 0 0 1 1 0 black 0 0 0 0 1 0 1 0 0 0 black green
Kampuchea 5 1 181 6 10 3 0 0 2 1 0 0 1 0 0 0 red 0 0 0 0 0 0 0 1 0 0 red red
Kenya 4 1 583 17 10 5 0 5 4 1 1 0 0 1 1 0 red 1 0 0 0 0 0 0 1 0 0 black green
Kiribati 6 1 0 0 1 1 0 0 4 1 0 1 1 1 0 0 red 0 0 0 0 1 0 0 1 1 0 red blue
Kuwait 5 1 18 2 8 2 0 3 4 1 1 0 0 1 1 0 green 0 0 0 0 0 0 0 0 0 0 green red
Laos 5 1 236 3 10 6 0 3 3 1 0 1 0 1 0 0 red 1 0 0 0 0 0 0 0 0 0 red red
Lebanon 5 1 10 3 8 2 0 2 4 1 1 0 0 1 0 1 red 0 0 0 0 0 0 0 0 1 0 red red
Lesotho 4 2 30 1 10 5 2 0 4 1 1 1 0 1 0 0 blue 0 0 0 0 0 0 0 1 0 0 green blue
Liberia 4 4 111 1 10 5 0 11 3 1 0 1 0 1 0 0 red 0 0 0 1 1 0 0 0 0 0 blue red
Libya 4 1 1760 3 8 2 0 0 1 0 1 0 0 0 0 0 green 0 0 0 0 0 0 0 0 0 0 green green
Liechtenstein 3 1 0 0 4 0 0 2 3 1 0 1 1 0 0 0 red 0 0 0 0 0 0 0 1 0 0 blue red
Luxembourg 3 1 3 0 4 0 0 3 3 1 0 1 0 1 0 0 red 0 0 0 0 0 0 0 0 0 0 red blue
Malagasy 4 2 587 9 10 1 1 2 3 1 1 0 0 1 0 0 red 0 0 0 0 0 0 0 0 0 0 white green
Malawi 4 2 118 6 10 5 0 3 3 1 1 0 0 0 1 0 red 0 0 0 0 1 0 0 0 0 0 black green
Malaysia 5 1 333 13 10 2 0 14 4 1 0 1 1 1 0 0 red 0 0 0 1 1 1 0 0 0 0 blue white
Maldive-Islands 5 1 0 0 10 2 0 0 3 1 1 0 0 1 0 0 red 0 0 0 0 0 1 0 0 0 0 red red
Mali 4 4 1240 7 3 2 3 0 3 1 1 0 1 0 0 0 gold 0 0 0 0 0 0 0 0 0 0 green red
Malta 3 1 0 0 10 0 2 0 3 1 0 0 0 1 1 0 red 0 1 0 0 0 0 0 1 0 0 white red
Marianas 6 1 0 0 10 1 0 0 3 0 0 1 0 1 0 0 blue 0 0 0 0 1 0 0 1 0 0 blue blue
Mauritania 4 4 1031 2 8 2 0 0 2 0 1 0 1 0 0 0 green 0 0 0 0 1 1 0 0 0 0 green green
Mauritius 4 2 2 1 1 4 0 4 4 1 1 1 1 0 0 0 red 0 0 0 0 0 0 0 0 0 0 red green
Mexico 1 4 1973 77 2 0 3 0 4 1 1 0 0 1 0 1 green 0 0 0 0 0 0 0 0 1 0 green red
Micronesia 6 1 1 0 10 1 0 0 2 0 0 1 0 1 0 0 blue 0 0 0 0 4 0 0 0 0 0 blue blue
Monaco 3 1 0 0 3 0 0 2 2 1 0 0 0 1 0 0 red 0 0 0 0 0 0 0 0 0 0 red white
Mongolia 5 1 1566 2 10 6 3 0 3 1 0 1 1 0 0 0 red 2 0 0 0 1 1 1 1 0 0 red red
Montserrat 1 4 0 0 1 1 0 0 7 1 1 1 1 1 1 0 blue 0 2 1 1 0 0 0 1 1 0 white blue
Morocco 4 4 447 20 8 2 0 0 2 1 1 0 0 0 0 0 red 0 0 0 0 1 0 0 0 0 0 red red
Mozambique 4 2 783 12 10 5 0 5 5 1 1 0 1 1 1 0 gold 0 0 0 0 1 0 1 1 0 0 green gold
Nauru 6 2 0 0 10 1 0 3 3 0 0 1 1 1 0 0 blue 0 0 0 0 1 0 0 0 0 0 blue blue
Nepal 5 1 140 16 10 4 0 0 3 0 0 1 0 1 0 1 brown 0 0 0 0 2 1 0 0 0 0 blue blue
Netherlands 3 1 41 14 6 1 0 3 3 1 0 1 0 1 0 0 red 0 0 0 0 0 0 0 0 0 0 red blue
Netherlands-Antilles 1 4 0 0 6 1 0 1 3 1 0 1 0 1 0 0 white 0 0 0 0 6 0 0 0 0 0 white white
New-Zealand 6 2 268 2 1 1 0 0 3 1 0 1 0 1 0 0 blue 0 1 1 1 4 0 0 0 0 0 white blue
Nicaragua 1 4 128 3 2 0 0 3 2 0 0 1 0 1 0 0 blue 0 0 0 0 0 0 0 0 0 0 blue blue
Niger 4 1 1267 5 3 2 0 3 3 0 1 0 0 1 0 1 orange 1 0 0 0 0 0 0 0 0 0 orange green
Nigeria 4 1 925 56 10 2 3 0 2 0 1 0 0 1 0 0 green 0 0 0 0 0 0 0 0 0 0 green green
Niue 6 3 0 0 1 1 0 0 4 1 0 1 1 1 0 0 gold 1 1 1 1 5 0 0 0 0 0 white gold
North-Korea 5 1 121 18 10 6 0 5 3 1 0 1 0 1 0 0 blue 1 0 0 0 1 0 0 0 0 0 blue blue
North-Yemen 5 1 195 9 8 2 0 3 4 1 1 0 0 1 1 0 red 0 0 0 0 1 0 0 0 0 0 red black
Norway 3 1 324 4 6 1 0 0 3 1 0 1 0 1 0 0 red 0 1 0 0 0 0 0 0 0 0 red red
Oman 5 1 212 1 8 2 0 2 3 1 1 0 0 1 0 0 red 0 0 0 0 0 0 0 1 0 0 red green
Pakistan 5 1 804 84 6 2 1 0 2 0 1 0 0 1 0 0 green 0 0 0 0 1 1 0 0 0 0 white green
Panama 2 4 76 2 2 0 0 0 3 1 0 1 0 1 0 0 red 0 0 0 4 2 0 0 0 0 0 white white
Papua-New-Guinea 6 2 463 3 1 5 0 0 4 1 0 0 1 1 1 0 black 0 0 0 0 5 0 1 0 1 0 red black
Parguay 2 3 407 3 2 0 0 3 6 1 1 1 1 1 1 0 red 1 0 0 0 1 0 0 1 1 1 red blue
Peru 2 3 1285 14 2 0 3 0 2 1 0 0 0 1 0 0 red 0 0 0 0 0 0 0 0 0 0 red red
Philippines 6 1 300 48 10 0 0 0 4 1 0 1 1 1 0 0 blue 0 0 0 0 4 0 1 0 0 0 blue red
Poland 3 1 313 36 5 6 0 2 2 1 0 0 0 1 0 0 white 0 0 0 0 0 0 0 0 0 0 white red
Portugal 3 4 92 10 6 0 0 0 5 1 1 1 1 1 0 0 red 1 0 0 0 0 0 0 1 0 0 green red
Puerto-Rico 1 4 9 3 2 0 0 5 3 1 0 1 0 1 0 0 red 0 0 0 0 1 0 1 0 0 0 red red
Qatar 5 1 11 0 8 2 0 0 2 0 0 0 0 1 0 1 brown 0 0 0 0 0 0 0 0 0 0 white brown
Romania 3 1 237 22 6 6 3 0 7 1 1 1 1 1 0 1 red 0 0 0 0 2 0 0 1 1 1 blue red
Rwanda 4 2 26 5 10 5 3 0 4 1 1 0 1 0 1 0 red 0 0 0 0 0 0 0 0 0 1 red green
San-Marino 3 1 0 0 6 0 0 2 2 0 0 1 0 1 0 0 white 0 0 0 0 0 0 0 0 0 0 white blue
Sao-Tome 4 1 0 0 6 0 0 3 4 1 1 0 1 0 1 0 green 0 0 0 0 2 0 1 0 0 0 green green
Saudi-Arabia 5 1 2150 9 8 2 0 0 2 0 1 0 0 1 0 0 green 0 0 0 0 0 0 0 1 0 1 green green
Senegal 4 4 196 6 3 2 3 0 3 1 1 0 1 0 0 0 green 0 0 0 0 1 0 0 0 0 0 green red
Seychelles 4 2 0 0 1 1 0 0 3 1 1 0 0 1 0 0 red 0 0 0 0 0 0 0 0 0 0 red green
Sierra-Leone 4 4 72 3 1 5 0 3 3 0 1 1 0 1 0 0 green 0 0 0 0 0 0 0 0 0 0 green blue
Singapore 5 1 1 3 7 3 0 2 2 1 0 0 0 1 0 0 white 0 0 0 0 5 1 0 0 0 0 red white
Soloman-Islands 6 2 30 0 1 1 0 0 4 0 1 1 1 1 0 0 green 0 0 0 0 5 0 1 0 0 0 blue green
Somalia 4 1 637 5 10 2 0 0 2 0 0 1 0 1 0 0 blue 0 0 0 0 1 0 0 0 0 0 blue blue
South-Africa 4 2 1221 29 6 1 0 3 5 1 1 1 0 1 0 1 orange 0 1 1 0 0 0 0 0 0 0 orange blue
South-Korea 5 1 99 39 10 7 0 0 4 1 0 1 0 1 1 0 white 1 0 0 0 0 0 0 1 0 0 white white
South-Yemen 5 1 288 2 8 2 0 3 4 1 0 1 0 1 1 0 red 0 0 0 0 1 0 1 0 0 0 red black
Spain 3 4 505 38 2 0 0 3 2 1 0 0 1 0 0 0 red 0 0 0 0 0 0 0 0 0 0 red red
Sri-Lanka 5 1 66 15 10 3 2 0 4 0 1 0 1 0 0 1 gold 0 0 0 0 0 0 0 1 1 0 gold gold
St-Helena 4 3 0 0 1 1 0 0 7 1 1 1 1 1 0 1 blue 0 1 1 1 0 0 0 1 0 0 white blue
St-Kitts-Nevis 1 4 0 0 1 1 0 0 5 1 1 0 1 1 1 0 green 0 0 0 0 2 0 1 0 0 0 green red
St-Lucia 1 4 0 0 1 1 0 0 4 0 0 1 1 1 1 0 blue 0 0 0 0 0 0 1 0 0 0 blue blue
St-Vincent 1 4 0 0 1 1 5 0 4 0 1 1 1 1 0 0 green 0 0 0 0 0 0 0 1 1 1 blue green
Sudan 4 1 2506 20 8 2 0 3 4 1 1 0 0 1 1 0 red 0 0 0 0 0 0 1 0 0 0 red black
Surinam 2 4 63 0 6 1 0 5 4 1 1 0 1 1 0 0 red 0 0 0 0 1 0 0 0 0 0 green green
Swaziland 4 2 17 1 10 1 0 5 7 1 0 1 1 1 1 1 blue 0 0 0 0 0 0 0 1 0 0 blue blue
Sweden 3 1 450 8 6 1 0 0 2 0 0 1 1 0 0 0 blue 0 1 0 0 0 0 0 0 0 0 blue blue
Switzerland 3 1 41 6 4 1 0 0 2 1 0 0 0 1 0 0 red 0 1 0 0 0 0 0 0 0 0 red red
Syria 5 1 185 10 8 2 0 3 4 1 1 0 0 1 1 0 red 0 0 0 0 2 0 0 0 0 0 red black
Taiwan 5 1 36 18 7 3 0 0 3 1 0 1 0 1 0 0 red 1 0 0 1 1 0 0 0 0 0 blue red
Tanzania 4 2 945 18 10 5 0 0 4 0 1 1 1 0 1 0 green 0 0 0 0 0 0 1 0 0 0 green blue
Thailand 5 1 514 49 10 3 0 5 3 1 0 1 0 1 0 0 red 0 0 0 0 0 0 0 0 0 0 red red
Togo 4 1 57 2 3 7 0 5 4 1 1 0 1 1 0 0 green 0 0 0 1 1 0 0 0 0 0 red green
Tonga 6 2 1 0 10 1 0 0 2 1 0 0 0 1 0 0 red 0 1 0 1 0 0 0 0 0 0 white red
Trinidad-Tobago 2 4 5 1 1 1 0 0 3 1 0 0 0 1 1 0 red 0 0 0 0 0 0 1 0 0 0 white white
Tunisia 4 1 164 7 8 2 0 0 2 1 0 0 0 1 0 0 red 1 0 0 0 1 1 0 0 0 0 red red
Turkey 5 1 781 45 9 2 0 0 2 1 0 0 0 1 0 0 red 0 0 0 0 1 1 0 0 0 0 red red
Turks-Cocos-Islands 1 4 0 0 1 1 0 0 6 1 1 1 1 1 0 1 blue 0 1 1 1 0 0 0 1 1 0 white blue
Tuvalu 6 2 0 0 1 1 0 0 5 1 0 1 1 1 0 0 blue 0 1 1 1 9 0 0 0 0 0 white blue
UAE 5 1 84 1 8 2 1 3 4 1 1 0 0 1 1 0 green 0 0 0 0 0 0 0 0 0 0 red black
Uganda 4 1 236 13 10 5 0 6 5 1 0 0 1 1 1 0 gold 1 0 0 0 0 0 0 0 1 0 black red
UK 3 4 245 56 1 1 0 0 3 1 0 1 0 1 0 0 red 0 1 1 0 0 0 0 0 0 0 white red
Uruguay 2 3 178 3 2 0 0 9 3 0 0 1 1 1 0 0 white 0 0 0 1 1 0 0 0 0 0 white white
US-Virgin-Isles 1 4 0 0 1 1 0 0 6 1 1 1 1 1 0 0 white 0 0 0 0 0 0 0 1 1 1 white white
USA 1 4 9363 231 1 1 0 13 3 1 0 1 0 1 0 0 white 0 0 0 1 50 0 0 0 0 0 blue red
USSR 5 1 22402 274 5 6 0 0 2 1 0 0 1 0 0 0 red 0 0 0 0 1 0 0 1 0 0 red red
Vanuatu 6 2 15 0 6 1 0 0 4 1 1 0 1 0 1 0 red 0 0 0 0 0 0 1 0 1 0 black green
Vatican-City 3 1 0 0 6 0 2 0 4 1 0 0 1 1 1 0 gold 0 0 0 0 0 0 0 1 0 0 gold white
Venezuela 2 4 912 15 2 0 0 3 7 1 1 1 1 1 1 1 red 0 0 0 0 7 0 0 1 1 0 gold red
Vietnam 5 1 333 60 10 6 0 0 2 1 0 0 1 0 0 0 red 0 0 0 0 1 0 0 0 0 0 red red
Western-Samoa 6 3 3 0 1 1 0 0 3 1 0 1 0 1 0 0 red 0 0 0 1 5 0 0 0 0 0 blue red
Yugoslavia 3 1 256 22 6 6 0 3 4 1 0 1 1 1 0 0 red 0 0 0 0 1 0 0 0 0 0 blue red
Zaire 4 2 905 28 10 5 0 0 4 1 1 0 1 0 0 1 green 1 0 0 0 0 0 0 1 1 0 green green
Zambia 4 2 753 6 10 5 3 0 4 1 1 0 0 0 1 1 green 0 0 0 0 0 0 0 0 1 0 green brown
Zimbabwe 4 2 391 8 10 5 0 7 5 1 1 0 1 1 1 0 green 0 0 0 0 1 0 1 1 1 0 green green
Display the source blob
Display the rendered blob
Raw
# Find the Flag
Can you guess which continent this flag comes from?
![flag](https://content.codecademy.com/programs/data-science-path/decision-trees/reunion.png?width=300)
What are some of the features that would clue you in? Maybe some of the colors are good indicators. The presence or absence of certain shapes could give you a hint. In this project, we’ll use decision trees to try to predict the continent of flags based on several of these features.
We'll explore which features are the best to use and the best way to create your decision tree.
```python
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
import matplotlib.pyplot as plt
```
### Investigate the Data
1. Let's start by seeing what the data looks like. Begin by loading the data into a variable named flags using Panda's pd.read_csv() function. The function should take the name of the CSV file you want to load. In this case, our file is named "flags.csv".
We also want row 0 to be used as the header, so include the parameter header = 0.
2. Take a look at the names of the columns in our DataFrame. These are the features we have available to us. Print flags.columns.
Let's also take a look at the first few rows of the dataset. Print flags.head().
3. Many columns contain numbers that don't make a lot of sense. For example, the third row, which represents Algeria, has a Language of 8. What exactly does that mean?
Take a look at the Attribute Information for this dataset from UCI's Machine Learning Repository.
Using that information along with the printout of flags.head(), can you figure out what landmass Andorra is on?
### Creating Your Data and Labels
4. We're eventually going to use create a decision tree to classify what Landmass a country is on.
Create a variable named labels and set it equal to only the "Landmass" column from flags.
You can grab specific columns from a DataFrame using this syntax:
```python
one_column = df[["A"]]
two_columns = df[["B", "C"]]
```
In this example
- one_column will be a DataFrame of only df's "A" column.
- two_columns will be a DataFrame of the "B" and "C" columns from df.
5. We have our labels. Now we want to choose which columns will help our decision tree correctly classify those labels.
You could spend a lot of time playing with groups of columns to find the that work best. But for now, let's see if we can predict where a country is based only on the colors of its flag.
Create a variable named data and set it equal to a DataFrame containing the following columns from flags:
"Red"
"Green"
"Blue"
"Gold"
"White"
"Black"
"Orange"
6. Finally, let's split these DataFrames into a training set and test set using the `train_test_split()` function. This function should take data and labels as parameters. Also include the parameter `random_state = 1`.
This function returns four values. Name those values `train_data`, `test_data`, `train_labels`, and `test_labels` in that order.
### Make and Test the Model
7. Create a DecisionTreeClassifier and name it tree. When you create the tree, give it the parameter random_state = 1.
8. Call tree' s .fit() method using train_data and train_labels to fit the tree to the training data.
9. Call .score() using test_data and test_labels. Print the result.
Since there are six possible landmasses, if we randomly guessed, we'd expect to be right about 16% of the time. Did our decision tree beat randomly guessing?
### Tuning the Model
10. We now have a good baseline of how our model performs with these features. Let's see if we can prune the tree to make it better!
Put your code that creates, trains, and tests the tree inside a for loop that has a variable named i that increases from 1 to 20.
Inside your for loop, when you create tree, give it the parameter `max_depth = i`.
We'll now see a printout of how the accuracy changes depending on how large we allow the tree to be.
11. Rather than printing the score of each tree, let's graph it! We want the x-axis to show the depth of the tree and the y-axis to show the tree's score.
To do this, we'll need to create a list containing all of the scores. Before the for loop, create an empty list named scores. Inside the loop, instead of printing the tree's score, use .append() to add it to scores.
12. Let's now plot our points. Call plt.plot() using two parameters. The first should be the points on the x-axis. In this case, that is range(1, 21). The second should be scores.
Then call plt.show().
13. Our graph doesn't really look like we would expect it to. It seems like the depth of the tree isn't really having an impact on its performance. This might be a good indication that we're not using enough features.
Let's add all the features that have to do with shapes to our data. data should now be set equal to:
flags[["Red", "Green", "Blue", "Gold",
"White", "Black", "Orange",
"Circles",
"Crosses","Saltires","Quarters","Sunstars",
"Crescent","Triangle"]]
### Explore on Your Own
14. Nice work! That graph looks more like what we'd expect. If the tree is too short, we're underfitting and not accurately representing the training data. If the tree is too big, we're getting too specific and relying too heavily on the training data.
There are a few different ways to extend this project:
Try to classify something else! Rather than predicting the "Landmass" feature, could predict something like the "Language"?
Find a subset of features that work better than what we're currently using. An important note is that a feature that has categorical data won't work very well as a feature. For example, we don't want a decision node to split nodes based on whether the value for "Language" is above or below 5. Tune more parameters of the model. You can find a description of all the parameters you can tune in the Decision Tree Classifier documentation. For example, see what happens if you tune max_leaf_nodes. Think about whether you would be overfitting or underfitting the data based on how many leaf nodes you allow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment