Spaces:
Sleeping
Sleeping
Vela
commited on
Commit
·
dfc542c
1
Parent(s):
99680ce
added files
Browse files- .gitignore +1 -0
- Dockerfile +30 -0
- api/__pycache__/__init__.cpython-312.pyc +0 -0
- api/__pycache__/end_points.cpython-312.pyc +0 -0
- api/__pycache__/main.cpython-312.pyc +0 -0
- api/__pycache__/models.cpython-312.pyc +0 -0
- api/__pycache__/schema.cpython-312.pyc +0 -0
- api/end_points.py +20 -0
- api/main.py +92 -0
- api/schema.py +8 -0
- data/world_population.csv +235 -0
- modules/__pycache__/__init__.cpython-312.pyc +0 -0
- modules/__pycache__/home_page.cpython-312.pyc +0 -0
- modules/home_page.py +147 -0
- requirements.txt +2 -0
- utils/__pycache__/__init__.cpython-312.pyc +0 -0
- utils/__pycache__/logger.cpython-312.pyc +0 -0
- utils/logger.py +9 -0
- world_population.csv +235 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.venv
|
Dockerfile
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# FROM python:3.9
|
3 |
+
|
4 |
+
|
5 |
+
# WORKDIR /code
|
6 |
+
|
7 |
+
|
8 |
+
# COPY ./requirements.txt /code/requirements.txt
|
9 |
+
|
10 |
+
# RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
11 |
+
|
12 |
+
# EXPOSE 80
|
13 |
+
|
14 |
+
# COPY . /code/
|
15 |
+
|
16 |
+
# CMD ["fastapi","run", "api/main.py", "--port", "8000"]
|
17 |
+
|
18 |
+
FROM python:3.9
|
19 |
+
|
20 |
+
RUN useradd -m -u 1000 user
|
21 |
+
USER user
|
22 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
23 |
+
|
24 |
+
WORKDIR /app
|
25 |
+
|
26 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
27 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
28 |
+
|
29 |
+
COPY --chown=user . /app
|
30 |
+
CMD ["uvicorn", "api/main:app", "--host", "0.0.0.0", "--port", "7860"]
|
api/__pycache__/__init__.cpython-312.pyc
ADDED
Binary file (168 Bytes). View file
|
|
api/__pycache__/end_points.cpython-312.pyc
ADDED
Binary file (1.13 kB). View file
|
|
api/__pycache__/main.cpython-312.pyc
ADDED
Binary file (3.06 kB). View file
|
|
api/__pycache__/models.cpython-312.pyc
ADDED
Binary file (586 Bytes). View file
|
|
api/__pycache__/schema.cpython-312.pyc
ADDED
Binary file (576 Bytes). View file
|
|
api/end_points.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def welcome_msg():
|
2 |
+
welcome_msg = "Hello !! Welcome to my data base"
|
3 |
+
base_url = "http://127.0.0.1:8000"
|
4 |
+
|
5 |
+
cont_pop = {"End Points to get population" : {
|
6 |
+
"max_population": f"{base_url}/Continent/Population/max",
|
7 |
+
"min_population": f"{base_url}/Continent/Population/min",
|
8 |
+
"average_population": f"{base_url}/Continent/Population/average",
|
9 |
+
"total_population": f"{base_url}/Continent/Population/total"
|
10 |
+
}}
|
11 |
+
|
12 |
+
cont_area = {"End point to get area" : {
|
13 |
+
"max_area": f"{base_url}/Continent/Area/max",
|
14 |
+
"min_area": f"{base_url}/Continent/Area/min",
|
15 |
+
"average_area": f"{base_url}/Continent/Area/average",
|
16 |
+
"total_area": f"{base_url}/Continent/Area/total"
|
17 |
+
}}
|
18 |
+
|
19 |
+
cont_list ={"End point to get list of countries in continent":f"{base_url}/Continent"}
|
20 |
+
return welcome_msg, cont_list, cont_pop, cont_area
|
api/main.py
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
2 |
+
import os
|
3 |
+
import sys
|
4 |
+
src_directory = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..", "world_data_insights_api"))
|
5 |
+
sys.path.append(src_directory)
|
6 |
+
from modules import home_page
|
7 |
+
from api.schema import CountryDetails
|
8 |
+
from utils import logger
|
9 |
+
|
10 |
+
app = FastAPI()
|
11 |
+
|
12 |
+
df = home_page.process_data()
|
13 |
+
|
14 |
+
@app.get("/")
|
15 |
+
def display_data():
|
16 |
+
return df.to_csv()
|
17 |
+
|
18 |
+
@app.get("/ShowAllContinents")
|
19 |
+
def display_continents():
|
20 |
+
continents = home_page.display_continents(df)
|
21 |
+
return continents.tolist()
|
22 |
+
|
23 |
+
@app.get("/ShowAllCountries")
|
24 |
+
def display_countries():
|
25 |
+
countries = home_page.display_countries(df)
|
26 |
+
return countries.tolist()
|
27 |
+
|
28 |
+
@app.get("/ShowContinentwithHighestPopulation")
|
29 |
+
def display_cont_with_high_pop():
|
30 |
+
highest_pop = home_page.continent_with_highest_population(df)
|
31 |
+
return highest_pop
|
32 |
+
|
33 |
+
@app.get("/ShowContinentwithLowestPopulation")
|
34 |
+
def display_cont_with_high_pop():
|
35 |
+
lowest_pop = home_page.continent_with_lowest_population(df)
|
36 |
+
return lowest_pop
|
37 |
+
|
38 |
+
@app.get("/ShowCountrywithHighestPopulation")
|
39 |
+
def display_country_with_high_pop():
|
40 |
+
highest_pop = home_page.country_with_highest_population(df)
|
41 |
+
return highest_pop
|
42 |
+
|
43 |
+
@app.get("/ShowCountrywithLowestPopulation")
|
44 |
+
def display_country_with_high_pop():
|
45 |
+
lowest_pop = home_page.country_with_lowest_population(df)
|
46 |
+
return lowest_pop
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
|
71 |
+
# highest_pop = home_page.display_countries(df).tolist()
|
72 |
+
# print(type(highest_pop))
|
73 |
+
|
74 |
+
# @app.get("/")
|
75 |
+
# def home():
|
76 |
+
# return end_points.welcome_msg()
|
77 |
+
|
78 |
+
# @app.get('/{continent}')
|
79 |
+
# def present_countries(continent : str):
|
80 |
+
# return home_page.list_country_by_continent(df, continent)
|
81 |
+
|
82 |
+
|
83 |
+
# @app.get("/{continent}/{data_type}/{stat}")
|
84 |
+
# def get_stats_of_cont(continent:str, data_type : str, stat:str):
|
85 |
+
# return home_page.get_stat_by_continent(df,continent,data_type,stat)
|
86 |
+
|
87 |
+
# @app.get("/{key}/{value}")
|
88 |
+
# def get_stats_of_cont(key : str ,value : str):
|
89 |
+
# return home_page.get_continent_with_max_value(df, key, value)
|
90 |
+
|
91 |
+
|
92 |
+
|
api/schema.py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pydantic import BaseModel,Field
|
2 |
+
|
3 |
+
class CountryDetails(BaseModel):
|
4 |
+
country_name:str
|
5 |
+
continent:str
|
6 |
+
population:int
|
7 |
+
area:int
|
8 |
+
capital:str
|
data/world_population.csv
ADDED
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Country,Capital,Continent,Population,Area
|
2 |
+
China,Beijing,Asia,1425887337,9706961
|
3 |
+
India,New Delhi,Asia,1417173173,3287590
|
4 |
+
United States,"Washington, D.C.",North America,338289857,9372610
|
5 |
+
Indonesia,Jakarta,Asia,275501339,1904569
|
6 |
+
Pakistan,Islamabad,Asia,235824862,881912
|
7 |
+
Nigeria,Abuja,Africa,218541212,923768
|
8 |
+
Brazil,Brasilia,South America,215313498,8515767
|
9 |
+
Bangladesh,Dhaka,Asia,171186372,147570
|
10 |
+
Russia,Moscow,Europe,144713314,17098242
|
11 |
+
Mexico,Mexico City,North America,127504125,1964375
|
12 |
+
Japan,Tokyo,Asia,123951692,377930
|
13 |
+
Ethiopia,Addis Ababa,Africa,123379924,1104300
|
14 |
+
Philippines,Manila,Asia,115559009,342353
|
15 |
+
Egypt,Cairo,Africa,110990103,1002450
|
16 |
+
DR Congo,Kinshasa,Africa,99010212,2344858
|
17 |
+
Vietnam,Hanoi,Asia,98186856,331212
|
18 |
+
Iran,Tehran,Asia,88550570,1648195
|
19 |
+
Turkey,Ankara,Asia,85341241,783562
|
20 |
+
Germany,Berlin,Europe,83369843,357114
|
21 |
+
Thailand,Bangkok,Asia,71697030,513120
|
22 |
+
United Kingdom,London,Europe,67508936,242900
|
23 |
+
Tanzania,Dodoma,Africa,65497748,945087
|
24 |
+
France,Paris,Europe,64626628,551695
|
25 |
+
South Africa,Pretoria,Africa,59893885,1221037
|
26 |
+
Italy,Rome,Europe,59037474,301336
|
27 |
+
Myanmar,Nay Pyi Taw,Asia,54179306,676578
|
28 |
+
Kenya,Nairobi,Africa,54027487,580367
|
29 |
+
Colombia,Bogota,South America,51874024,1141748
|
30 |
+
South Korea,Seoul,Asia,51815810,100210
|
31 |
+
Spain,Madrid,Europe,47558630,505992
|
32 |
+
Uganda,Kampala,Africa,47249585,241550
|
33 |
+
Sudan,Khartoum,Africa,46874204,1886068
|
34 |
+
Argentina,Buenos Aires,South America,45510318,2780400
|
35 |
+
Algeria,Algiers,Africa,44903225,2381741
|
36 |
+
Iraq,Baghdad,Asia,44496122,438317
|
37 |
+
Afghanistan,Kabul,Asia,41128771,652230
|
38 |
+
Poland,Warsaw,Europe,39857145,312679
|
39 |
+
Ukraine,Kiev,Europe,39701739,603500
|
40 |
+
Canada,Ottawa,North America,38454327,9984670
|
41 |
+
Morocco,Rabat,Africa,37457971,446550
|
42 |
+
Saudi Arabia,Riyadh,Asia,36408820,2149690
|
43 |
+
Angola,Luanda,Africa,35588987,1246700
|
44 |
+
Uzbekistan,Tashkent,Asia,34627652,447400
|
45 |
+
Peru,Lima,South America,34049588,1285216
|
46 |
+
Malaysia,Kuala Lumpur,Asia,33938221,330803
|
47 |
+
Yemen,Sanaa,Asia,33696614,527968
|
48 |
+
Ghana,Accra,Africa,33475870,238533
|
49 |
+
Mozambique,Maputo,Africa,32969517,801590
|
50 |
+
Nepal,Kathmandu,Asia,30547580,147181
|
51 |
+
Madagascar,Antananarivo,Africa,29611714,587041
|
52 |
+
Venezuela,Caracas,South America,28301696,916445
|
53 |
+
Ivory Coast,Yamoussoukro,Africa,28160542,322463
|
54 |
+
Cameroon,Yaounde,Africa,27914536,475442
|
55 |
+
Niger,Niamey,Africa,26207977,1267000
|
56 |
+
Australia,Canberra,Oceania,26177413,7692024
|
57 |
+
North Korea,Pyongyang,Asia,26069416,120538
|
58 |
+
Taiwan,Taipei,Asia,23893394,36193
|
59 |
+
Burkina Faso,Ouagadougou,Africa,22673762,272967
|
60 |
+
Mali,Bamako,Africa,22593590,1240192
|
61 |
+
Syria,Damascus,Asia,22125249,185180
|
62 |
+
Sri Lanka,Colombo,Asia,21832143,65610
|
63 |
+
Malawi,Lilongwe,Africa,20405317,118484
|
64 |
+
Zambia,Lusaka,Africa,20017675,752612
|
65 |
+
Romania,Bucharest,Europe,19659267,238391
|
66 |
+
Chile,Santiago,South America,19603733,756102
|
67 |
+
Kazakhstan,Nursultan,Asia,19397998,2724900
|
68 |
+
Ecuador,Quito,South America,18001000,276841
|
69 |
+
Guatemala,Guatemala City,North America,17843908,108889
|
70 |
+
Chad,N'Djamena,Africa,17723315,1284000
|
71 |
+
Somalia,Mogadishu,Africa,17597511,637657
|
72 |
+
Netherlands,Amsterdam,Europe,17564014,41850
|
73 |
+
Senegal,Dakar,Africa,17316449,196722
|
74 |
+
Cambodia,Phnom Penh,Asia,16767842,181035
|
75 |
+
Zimbabwe,Harare,Africa,16320537,390757
|
76 |
+
Guinea,Conakry,Africa,13859341,245857
|
77 |
+
Rwanda,Kigali,Africa,13776698,26338
|
78 |
+
Benin,Porto-Novo,Africa,13352864,112622
|
79 |
+
Burundi,Bujumbura,Africa,12889576,27834
|
80 |
+
Tunisia,Tunis,Africa,12356117,163610
|
81 |
+
Bolivia,Sucre,South America,12224110,1098581
|
82 |
+
Belgium,Brussels,Europe,11655930,30528
|
83 |
+
Haiti,Port-au-Prince,North America,11584996,27750
|
84 |
+
Jordan,Amman,Asia,11285869,89342
|
85 |
+
Dominican Republic,Santo Domingo,North America,11228821,48671
|
86 |
+
Cuba,Havana,North America,11212191,109884
|
87 |
+
South Sudan,Juba,Africa,10913164,619745
|
88 |
+
Sweden,Stockholm,Europe,10549347,450295
|
89 |
+
Czech Republic,Prague,Europe,10493986,78865
|
90 |
+
Honduras,Tegucigalpa,North America,10432860,112492
|
91 |
+
Greece,Athens,Europe,10384971,131990
|
92 |
+
Azerbaijan,Baku,Asia,10358074,86600
|
93 |
+
Portugal,Lisbon,Europe,10270865,92090
|
94 |
+
Papua New Guinea,Port Moresby,Oceania,10142619,462840
|
95 |
+
Hungary,Budapest,Europe,9967308,93028
|
96 |
+
Tajikistan,Dushanbe,Asia,9952787,143100
|
97 |
+
Belarus,Minsk,Europe,9534954,207600
|
98 |
+
United Arab Emirates,Abu Dhabi,Asia,9441129,83600
|
99 |
+
Israel,Jerusalem,Asia,9038309,20770
|
100 |
+
Austria,Vienna,Europe,8939617,83871
|
101 |
+
Togo,Lomé,Africa,8848699,56785
|
102 |
+
Switzerland,Bern,Europe,8740472,41284
|
103 |
+
Sierra Leone,Freetown,Africa,8605718,71740
|
104 |
+
Laos,Vientiane,Asia,7529475,236800
|
105 |
+
Hong Kong,Hong Kong,Asia,7488865,1104
|
106 |
+
Serbia,Belgrade,Europe,7221365,88361
|
107 |
+
Nicaragua,Managua,North America,6948392,130373
|
108 |
+
Libya,Tripoli,Africa,6812341,1759540
|
109 |
+
Bulgaria,Sofia,Europe,6781953,110879
|
110 |
+
Paraguay,Asunción,South America,6780744,406752
|
111 |
+
Kyrgyzstan,Bishkek,Asia,6630623,199951
|
112 |
+
Turkmenistan,Ashgabat,Asia,6430770,488100
|
113 |
+
El Salvador,San Salvador,North America,6336392,21041
|
114 |
+
Singapore,Singapore,Asia,5975689,710
|
115 |
+
Republic of the Congo,Brazzaville,Africa,5970424,342000
|
116 |
+
Denmark,Copenhagen,Europe,5882261,43094
|
117 |
+
Slovakia,Bratislava,Europe,5643453,49037
|
118 |
+
Central African Republic,Bangui,Africa,5579144,622984
|
119 |
+
Finland,Helsinki,Europe,5540745,338424
|
120 |
+
Lebanon,Beirut,Asia,5489739,10452
|
121 |
+
Norway,Oslo,Europe,5434319,323802
|
122 |
+
Liberia,Monrovia,Africa,5302681,111369
|
123 |
+
Palestine,Ramallah,Asia,5250072,6220
|
124 |
+
New Zealand,Wellington,Oceania,5185288,270467
|
125 |
+
Costa Rica,San José,North America,5180829,51100
|
126 |
+
Ireland,Dublin,Europe,5023109,70273
|
127 |
+
Mauritania,Nouakchott,Africa,4736139,1030700
|
128 |
+
Oman,Muscat,Asia,4576298,309500
|
129 |
+
Panama,Panama City,North America,4408581,75417
|
130 |
+
Kuwait,Kuwait City,Asia,4268873,17818
|
131 |
+
Croatia,Zagreb,Europe,4030358,56594
|
132 |
+
Georgia,Tbilisi,Asia,3744385,69700
|
133 |
+
Eritrea,Asmara,Africa,3684032,117600
|
134 |
+
Uruguay,Montevideo,South America,3422794,181034
|
135 |
+
Mongolia,Ulaanbaatar,Asia,3398366,1564110
|
136 |
+
Moldova,Chisinau,Europe,3272996,33846
|
137 |
+
Puerto Rico,San Juan,North America,3252407,8870
|
138 |
+
Bosnia and Herzegovina,Sarajevo,Europe,3233526,51209
|
139 |
+
Albania,Tirana,Europe,2842321,28748
|
140 |
+
Jamaica,Kingston,North America,2827377,10991
|
141 |
+
Armenia,Yerevan,Asia,2780469,29743
|
142 |
+
Lithuania,Vilnius,Europe,2750055,65300
|
143 |
+
Gambia,Banjul,Africa,2705992,10689
|
144 |
+
Qatar,Doha,Asia,2695122,11586
|
145 |
+
Botswana,Gaborone,Africa,2630296,582000
|
146 |
+
Namibia,Windhoek,Africa,2567012,825615
|
147 |
+
Gabon,Libreville,Africa,2388992,267668
|
148 |
+
Lesotho,Maseru,Africa,2305825,30355
|
149 |
+
Slovenia,Ljubljana,Europe,2119844,20273
|
150 |
+
Guinea-Bissau,Bissau,Africa,2105566,36125
|
151 |
+
North Macedonia,Skopje,Europe,2093599,25713
|
152 |
+
Latvia,Riga,Europe,1850651,64559
|
153 |
+
Equatorial Guinea,Malabo,Africa,1674908,28051
|
154 |
+
Trinidad and Tobago,Port-of-Spain,North America,1531044,5130
|
155 |
+
Bahrain,Manama,Asia,1472233,765
|
156 |
+
Timor-Leste,Dili,Asia,1341296,14874
|
157 |
+
Estonia,Tallinn,Europe,1326062,45227
|
158 |
+
Mauritius,Port Louis,Africa,1299469,2040
|
159 |
+
Cyprus,Nicosia,Europe,1251488,9251
|
160 |
+
Eswatini,Mbabane,Africa,1201670,17364
|
161 |
+
Djibouti,Djibouti,Africa,1120849,23200
|
162 |
+
Reunion,Saint-Denis,Africa,974052,2511
|
163 |
+
Fiji,Suva,Oceania,929766,18272
|
164 |
+
Comoros,Moroni,Africa,836774,1862
|
165 |
+
Guyana,Georgetown,South America,808726,214969
|
166 |
+
Bhutan,Thimphu,Asia,782455,38394
|
167 |
+
Solomon Islands,Honiara,Oceania,724273,28896
|
168 |
+
Macau,Concelho de Macau,Asia,695168,30
|
169 |
+
Luxembourg,Luxembourg,Europe,647599,2586
|
170 |
+
Montenegro,Podgorica,Europe,627082,13812
|
171 |
+
Suriname,Paramaribo,South America,618040,163820
|
172 |
+
Cape Verde,Praia,Africa,593149,4033
|
173 |
+
Western Sahara,El Aaiún,Africa,575986,266000
|
174 |
+
Malta,Valletta,Europe,533286,316
|
175 |
+
Maldives,Malé,Asia,523787,300
|
176 |
+
Brunei,Bandar Seri Begawan,Asia,449002,5765
|
177 |
+
Bahamas,Nassau,North America,409984,13943
|
178 |
+
Belize,Belmopan,North America,405272,22966
|
179 |
+
Guadeloupe,Basse-Terre,North America,395752,1628
|
180 |
+
Iceland,Reykjavík,Europe,372899,103000
|
181 |
+
Martinique,Fort-de-France,North America,367507,1128
|
182 |
+
Vanuatu,Port-Vila,Oceania,326740,12189
|
183 |
+
Mayotte,Mamoudzou,Africa,326101,374
|
184 |
+
French Polynesia,Papeete,Oceania,306279,4167
|
185 |
+
French Guiana,Cayenne,South America,304557,83534
|
186 |
+
New Caledonia,Nouméa,Oceania,289950,18575
|
187 |
+
Barbados,Bridgetown,North America,281635,430
|
188 |
+
Sao Tome and Principe,São Tomé,Africa,227380,964
|
189 |
+
Samoa,Apia,Oceania,222382,2842
|
190 |
+
Curacao,Willemstad,North America,191163,444
|
191 |
+
Saint Lucia,Castries,North America,179857,616
|
192 |
+
Guam,Hagåtña,Oceania,171774,549
|
193 |
+
Kiribati,Tarawa,Oceania,131232,811
|
194 |
+
Grenada,Saint George's,North America,125438,344
|
195 |
+
Micronesia,Palikir,Oceania,114164,702
|
196 |
+
Jersey,Saint Helier,Europe,110778,116
|
197 |
+
Seychelles,Victoria,Africa,107118,452
|
198 |
+
Tonga,Nuku‘alofa,Oceania,106858,747
|
199 |
+
Aruba,Oranjestad,North America,106445,180
|
200 |
+
Saint Vincent and the Grenadines,Kingstown,North America,103948,389
|
201 |
+
United States Virgin Islands,Charlotte Amalie,North America,99465,347
|
202 |
+
Antigua and Barbuda,Saint John’s,North America,93763,442
|
203 |
+
Isle of Man,Douglas,Europe,84519,572
|
204 |
+
Andorra,Andorra la Vella,Europe,79824,468
|
205 |
+
Dominica,Roseau,North America,72737,751
|
206 |
+
Cayman Islands,George Town,North America,68706,264
|
207 |
+
Bermuda,Hamilton,North America,64184,54
|
208 |
+
Guernsey,Saint Peter Port,Europe,63301,78
|
209 |
+
Greenland,Nuuk,North America,56466,2166086
|
210 |
+
Faroe Islands,Tórshavn,Europe,53090,1393
|
211 |
+
Northern Mariana Islands,Saipan,Oceania,49551,464
|
212 |
+
Saint Kitts and Nevis,Basseterre,North America,47657,261
|
213 |
+
Turks and Caicos Islands,Cockburn Town,North America,45703,948
|
214 |
+
American Samoa,Pago Pago,Oceania,44273,199
|
215 |
+
Sint Maarten,Philipsburg,North America,44175,34
|
216 |
+
Marshall Islands,Majuro,Oceania,41569,181
|
217 |
+
Liechtenstein,Vaduz,Europe,39327,160
|
218 |
+
Monaco,Monaco,Europe,36469,2
|
219 |
+
San Marino,San Marino,Europe,33660,61
|
220 |
+
Gibraltar,Gibraltar,Europe,32649,6
|
221 |
+
Saint Martin,Marigot,North America,31791,53
|
222 |
+
British Virgin Islands,Road Town,North America,31305,151
|
223 |
+
Palau,Ngerulmud,Oceania,18055,459
|
224 |
+
Cook Islands,Avarua,Oceania,17011,236
|
225 |
+
Anguilla,The Valley,North America,15857,91
|
226 |
+
Nauru,Yaren,Oceania,12668,21
|
227 |
+
Wallis and Futuna,Mata-Utu,Oceania,11572,142
|
228 |
+
Tuvalu,Funafuti,Oceania,11312,26
|
229 |
+
Saint Barthelemy,Gustavia,North America,10967,21
|
230 |
+
Saint Pierre and Miquelon,Saint-Pierre,North America,5862,242
|
231 |
+
Montserrat,Brades,North America,4390,102
|
232 |
+
Falkland Islands,Stanley,South America,3780,12173
|
233 |
+
Niue,Alofi,Oceania,1934,260
|
234 |
+
Tokelau,Nukunonu,Oceania,1871,12
|
235 |
+
Vatican City,Vatican City,Europe,510,1
|
modules/__pycache__/__init__.cpython-312.pyc
ADDED
Binary file (210 Bytes). View file
|
|
modules/__pycache__/home_page.cpython-312.pyc
ADDED
Binary file (7.42 kB). View file
|
|
modules/home_page.py
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import os
|
3 |
+
import sys
|
4 |
+
src_directory = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..", "world_data_insights_api"))
|
5 |
+
sys.path.append(src_directory)
|
6 |
+
from utils import logger
|
7 |
+
|
8 |
+
file_path = "./world_population.csv"
|
9 |
+
|
10 |
+
# file_path = "C:/Users/Vijay/Downloads/world_population.csv"
|
11 |
+
# data_frame = pd.read_csv(file_path)
|
12 |
+
|
13 |
+
def process_data():
|
14 |
+
try:
|
15 |
+
logger.log("I'm going to read the csv")
|
16 |
+
data_frame = pd.read_csv(file_path)
|
17 |
+
logger.log("I'm reading the csv")
|
18 |
+
return data_frame
|
19 |
+
except Exception as e :
|
20 |
+
logger.log("I couldn't read the file")
|
21 |
+
return f"Unable to read the file {e}"
|
22 |
+
|
23 |
+
def display_continents(dataframe):
|
24 |
+
continents = dataframe['Continent'].unique()
|
25 |
+
logger.log("Displaying the list of continents in the data")
|
26 |
+
return continents
|
27 |
+
|
28 |
+
def display_countries(dataframe):
|
29 |
+
countries = dataframe['Country'].values
|
30 |
+
logger.log("Displaying the list of countries in the data")
|
31 |
+
return countries
|
32 |
+
|
33 |
+
def continent_with_highest_population(dataframe):
|
34 |
+
highest= dataframe.groupby('Continent')['Population'].agg(total_population = 'sum')
|
35 |
+
max_continent = highest.idxmax().item()
|
36 |
+
max_population = highest.max().item()
|
37 |
+
result = {max_continent:max_population}
|
38 |
+
logger.log("Displaying the continent with highest population in the data")
|
39 |
+
return result
|
40 |
+
|
41 |
+
def continent_with_lowest_population(dataframe):
|
42 |
+
lowest= dataframe.groupby('Continent')['Population'].agg(total_population = 'sum')
|
43 |
+
min_continent = lowest.idxmin().item()
|
44 |
+
min_population = lowest.min().item()
|
45 |
+
result = {min_continent:min_population}
|
46 |
+
logger.log("Displaying the continent with lowest population in the data")
|
47 |
+
return result
|
48 |
+
|
49 |
+
def country_with_lowest_population(dataframe):
|
50 |
+
index= dataframe['Population'].idxmin()
|
51 |
+
min_country = dataframe['Country'][index]
|
52 |
+
min_population = dataframe['Population'][index]
|
53 |
+
result = {min_country:min_population.item()}
|
54 |
+
logger.log("Displaying the country with lowest population in the data")
|
55 |
+
return result
|
56 |
+
|
57 |
+
def country_with_highest_population(dataframe):
|
58 |
+
index= dataframe['Population'].idxmax()
|
59 |
+
max_country = dataframe['Country'][index]
|
60 |
+
max_population = dataframe['Population'][index]
|
61 |
+
result = {max_country:max_population.item()}
|
62 |
+
logger.log("Displaying the country with highest population in the data")
|
63 |
+
return result
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
def list_country_by_continent(dataframe,continent):
|
92 |
+
try:
|
93 |
+
df_countries = dataframe[dataframe['Continent'] == continent]
|
94 |
+
countries= df_countries['Country'].to_list()
|
95 |
+
logger.log("Separated data by continent")
|
96 |
+
return countries
|
97 |
+
except Exception as e:
|
98 |
+
return f"{e}"
|
99 |
+
|
100 |
+
def get_stat_by_continent(df ,continent: str, data_type: str, stat: str , ):
|
101 |
+
|
102 |
+
if continent.lower() == "NorthAmerica".lower():
|
103 |
+
continent = "North America"
|
104 |
+
if continent.lower() == "SouthAmerica".lower():
|
105 |
+
continent = "South America"
|
106 |
+
|
107 |
+
valid_stats = ['max', 'min', 'mean' , 'sum' , 'count']
|
108 |
+
if stat not in valid_stats:
|
109 |
+
return f"Invalid stat. Please use one of the following: {valid_stats}."
|
110 |
+
|
111 |
+
continent_population_stats = df.groupby('Continent')[data_type].agg(
|
112 |
+
Maximum='max', Minimum='min', Average = 'mean',Total='sum' , Number_of_Countries = 'count')
|
113 |
+
|
114 |
+
continent_countries = df[df['Continent'] == continent]
|
115 |
+
|
116 |
+
if continent not in continent_population_stats.index:
|
117 |
+
return f"Continent '{continent}' not found in the data."
|
118 |
+
|
119 |
+
if stat == 'max':
|
120 |
+
population_result = continent_population_stats.loc[continent]['Maximum']
|
121 |
+
country_id = continent_countries.loc[continent_countries[data_type].idxmax()]
|
122 |
+
country_name = country_id['Country']
|
123 |
+
population_value = country_id[data_type]
|
124 |
+
return f"{continent}'s {stat} {data_type} is {int(population_result)}. Country: {country_name} , {data_type} :{population_value}"
|
125 |
+
if stat == 'min':
|
126 |
+
population_result = continent_population_stats.loc[continent]['Minimum']
|
127 |
+
country_id = continent_countries.loc[continent_countries[data_type].idxmin()]
|
128 |
+
country_name = country_id['Country']
|
129 |
+
population_value = country_id[data_type]
|
130 |
+
return f"{continent}'s {stat} {data_type} is {int(population_result)}. Country: {country_name} , {data_type} :{population_value}"
|
131 |
+
if stat == 'mean':
|
132 |
+
population_result = continent_population_stats.loc[continent]['Average']
|
133 |
+
return f"{continent}'s average {data_type} is {int(population_result)}"
|
134 |
+
if stat == 'sum':
|
135 |
+
population_result = continent_population_stats.loc[continent]['Total']
|
136 |
+
return f"{continent}'s total {data_type} is {int(population_result)}"
|
137 |
+
if stat == 'count' :
|
138 |
+
population_result = continent_population_stats.loc[continent]['Number_of_Countries']
|
139 |
+
return f"Total countries in {continent} is {int(population_result)}"
|
140 |
+
|
141 |
+
def get_continent_with_max_value(dataframe, key, value):
|
142 |
+
max_id = dataframe[value].idxmax()
|
143 |
+
value_num = dataframe[value][max_id]
|
144 |
+
value_country = dataframe[key][max_id]
|
145 |
+
return f"{value_country}'s max {value} is {value_num}"
|
146 |
+
|
147 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastapi[standard]
|
2 |
+
pandas
|
utils/__pycache__/__init__.cpython-312.pyc
ADDED
Binary file (208 Bytes). View file
|
|
utils/__pycache__/logger.cpython-312.pyc
ADDED
Binary file (550 Bytes). View file
|
|
utils/logger.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
|
3 |
+
logging.basicConfig(
|
4 |
+
level=logging.INFO,
|
5 |
+
format='%(asctime)s - %(levelname)s - %(message)s',
|
6 |
+
datefmt='%Y-%m-%d %H:%M')
|
7 |
+
|
8 |
+
def log(message):
|
9 |
+
return logging.info(message)
|
world_population.csv
ADDED
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Country,Capital,Continent,Population,Area
|
2 |
+
China,Beijing,Asia,1425887337,9706961
|
3 |
+
India,New Delhi,Asia,1417173173,3287590
|
4 |
+
United States,"Washington, D.C.",North America,338289857,9372610
|
5 |
+
Indonesia,Jakarta,Asia,275501339,1904569
|
6 |
+
Pakistan,Islamabad,Asia,235824862,881912
|
7 |
+
Nigeria,Abuja,Africa,218541212,923768
|
8 |
+
Brazil,Brasilia,South America,215313498,8515767
|
9 |
+
Bangladesh,Dhaka,Asia,171186372,147570
|
10 |
+
Russia,Moscow,Europe,144713314,17098242
|
11 |
+
Mexico,Mexico City,North America,127504125,1964375
|
12 |
+
Japan,Tokyo,Asia,123951692,377930
|
13 |
+
Ethiopia,Addis Ababa,Africa,123379924,1104300
|
14 |
+
Philippines,Manila,Asia,115559009,342353
|
15 |
+
Egypt,Cairo,Africa,110990103,1002450
|
16 |
+
DR Congo,Kinshasa,Africa,99010212,2344858
|
17 |
+
Vietnam,Hanoi,Asia,98186856,331212
|
18 |
+
Iran,Tehran,Asia,88550570,1648195
|
19 |
+
Turkey,Ankara,Asia,85341241,783562
|
20 |
+
Germany,Berlin,Europe,83369843,357114
|
21 |
+
Thailand,Bangkok,Asia,71697030,513120
|
22 |
+
United Kingdom,London,Europe,67508936,242900
|
23 |
+
Tanzania,Dodoma,Africa,65497748,945087
|
24 |
+
France,Paris,Europe,64626628,551695
|
25 |
+
South Africa,Pretoria,Africa,59893885,1221037
|
26 |
+
Italy,Rome,Europe,59037474,301336
|
27 |
+
Myanmar,Nay Pyi Taw,Asia,54179306,676578
|
28 |
+
Kenya,Nairobi,Africa,54027487,580367
|
29 |
+
Colombia,Bogota,South America,51874024,1141748
|
30 |
+
South Korea,Seoul,Asia,51815810,100210
|
31 |
+
Spain,Madrid,Europe,47558630,505992
|
32 |
+
Uganda,Kampala,Africa,47249585,241550
|
33 |
+
Sudan,Khartoum,Africa,46874204,1886068
|
34 |
+
Argentina,Buenos Aires,South America,45510318,2780400
|
35 |
+
Algeria,Algiers,Africa,44903225,2381741
|
36 |
+
Iraq,Baghdad,Asia,44496122,438317
|
37 |
+
Afghanistan,Kabul,Asia,41128771,652230
|
38 |
+
Poland,Warsaw,Europe,39857145,312679
|
39 |
+
Ukraine,Kiev,Europe,39701739,603500
|
40 |
+
Canada,Ottawa,North America,38454327,9984670
|
41 |
+
Morocco,Rabat,Africa,37457971,446550
|
42 |
+
Saudi Arabia,Riyadh,Asia,36408820,2149690
|
43 |
+
Angola,Luanda,Africa,35588987,1246700
|
44 |
+
Uzbekistan,Tashkent,Asia,34627652,447400
|
45 |
+
Peru,Lima,South America,34049588,1285216
|
46 |
+
Malaysia,Kuala Lumpur,Asia,33938221,330803
|
47 |
+
Yemen,Sanaa,Asia,33696614,527968
|
48 |
+
Ghana,Accra,Africa,33475870,238533
|
49 |
+
Mozambique,Maputo,Africa,32969517,801590
|
50 |
+
Nepal,Kathmandu,Asia,30547580,147181
|
51 |
+
Madagascar,Antananarivo,Africa,29611714,587041
|
52 |
+
Venezuela,Caracas,South America,28301696,916445
|
53 |
+
Ivory Coast,Yamoussoukro,Africa,28160542,322463
|
54 |
+
Cameroon,Yaounde,Africa,27914536,475442
|
55 |
+
Niger,Niamey,Africa,26207977,1267000
|
56 |
+
Australia,Canberra,Oceania,26177413,7692024
|
57 |
+
North Korea,Pyongyang,Asia,26069416,120538
|
58 |
+
Taiwan,Taipei,Asia,23893394,36193
|
59 |
+
Burkina Faso,Ouagadougou,Africa,22673762,272967
|
60 |
+
Mali,Bamako,Africa,22593590,1240192
|
61 |
+
Syria,Damascus,Asia,22125249,185180
|
62 |
+
Sri Lanka,Colombo,Asia,21832143,65610
|
63 |
+
Malawi,Lilongwe,Africa,20405317,118484
|
64 |
+
Zambia,Lusaka,Africa,20017675,752612
|
65 |
+
Romania,Bucharest,Europe,19659267,238391
|
66 |
+
Chile,Santiago,South America,19603733,756102
|
67 |
+
Kazakhstan,Nursultan,Asia,19397998,2724900
|
68 |
+
Ecuador,Quito,South America,18001000,276841
|
69 |
+
Guatemala,Guatemala City,North America,17843908,108889
|
70 |
+
Chad,N'Djamena,Africa,17723315,1284000
|
71 |
+
Somalia,Mogadishu,Africa,17597511,637657
|
72 |
+
Netherlands,Amsterdam,Europe,17564014,41850
|
73 |
+
Senegal,Dakar,Africa,17316449,196722
|
74 |
+
Cambodia,Phnom Penh,Asia,16767842,181035
|
75 |
+
Zimbabwe,Harare,Africa,16320537,390757
|
76 |
+
Guinea,Conakry,Africa,13859341,245857
|
77 |
+
Rwanda,Kigali,Africa,13776698,26338
|
78 |
+
Benin,Porto-Novo,Africa,13352864,112622
|
79 |
+
Burundi,Bujumbura,Africa,12889576,27834
|
80 |
+
Tunisia,Tunis,Africa,12356117,163610
|
81 |
+
Bolivia,Sucre,South America,12224110,1098581
|
82 |
+
Belgium,Brussels,Europe,11655930,30528
|
83 |
+
Haiti,Port-au-Prince,North America,11584996,27750
|
84 |
+
Jordan,Amman,Asia,11285869,89342
|
85 |
+
Dominican Republic,Santo Domingo,North America,11228821,48671
|
86 |
+
Cuba,Havana,North America,11212191,109884
|
87 |
+
South Sudan,Juba,Africa,10913164,619745
|
88 |
+
Sweden,Stockholm,Europe,10549347,450295
|
89 |
+
Czech Republic,Prague,Europe,10493986,78865
|
90 |
+
Honduras,Tegucigalpa,North America,10432860,112492
|
91 |
+
Greece,Athens,Europe,10384971,131990
|
92 |
+
Azerbaijan,Baku,Asia,10358074,86600
|
93 |
+
Portugal,Lisbon,Europe,10270865,92090
|
94 |
+
Papua New Guinea,Port Moresby,Oceania,10142619,462840
|
95 |
+
Hungary,Budapest,Europe,9967308,93028
|
96 |
+
Tajikistan,Dushanbe,Asia,9952787,143100
|
97 |
+
Belarus,Minsk,Europe,9534954,207600
|
98 |
+
United Arab Emirates,Abu Dhabi,Asia,9441129,83600
|
99 |
+
Israel,Jerusalem,Asia,9038309,20770
|
100 |
+
Austria,Vienna,Europe,8939617,83871
|
101 |
+
Togo,Lomé,Africa,8848699,56785
|
102 |
+
Switzerland,Bern,Europe,8740472,41284
|
103 |
+
Sierra Leone,Freetown,Africa,8605718,71740
|
104 |
+
Laos,Vientiane,Asia,7529475,236800
|
105 |
+
Hong Kong,Hong Kong,Asia,7488865,1104
|
106 |
+
Serbia,Belgrade,Europe,7221365,88361
|
107 |
+
Nicaragua,Managua,North America,6948392,130373
|
108 |
+
Libya,Tripoli,Africa,6812341,1759540
|
109 |
+
Bulgaria,Sofia,Europe,6781953,110879
|
110 |
+
Paraguay,Asunción,South America,6780744,406752
|
111 |
+
Kyrgyzstan,Bishkek,Asia,6630623,199951
|
112 |
+
Turkmenistan,Ashgabat,Asia,6430770,488100
|
113 |
+
El Salvador,San Salvador,North America,6336392,21041
|
114 |
+
Singapore,Singapore,Asia,5975689,710
|
115 |
+
Republic of the Congo,Brazzaville,Africa,5970424,342000
|
116 |
+
Denmark,Copenhagen,Europe,5882261,43094
|
117 |
+
Slovakia,Bratislava,Europe,5643453,49037
|
118 |
+
Central African Republic,Bangui,Africa,5579144,622984
|
119 |
+
Finland,Helsinki,Europe,5540745,338424
|
120 |
+
Lebanon,Beirut,Asia,5489739,10452
|
121 |
+
Norway,Oslo,Europe,5434319,323802
|
122 |
+
Liberia,Monrovia,Africa,5302681,111369
|
123 |
+
Palestine,Ramallah,Asia,5250072,6220
|
124 |
+
New Zealand,Wellington,Oceania,5185288,270467
|
125 |
+
Costa Rica,San José,North America,5180829,51100
|
126 |
+
Ireland,Dublin,Europe,5023109,70273
|
127 |
+
Mauritania,Nouakchott,Africa,4736139,1030700
|
128 |
+
Oman,Muscat,Asia,4576298,309500
|
129 |
+
Panama,Panama City,North America,4408581,75417
|
130 |
+
Kuwait,Kuwait City,Asia,4268873,17818
|
131 |
+
Croatia,Zagreb,Europe,4030358,56594
|
132 |
+
Georgia,Tbilisi,Asia,3744385,69700
|
133 |
+
Eritrea,Asmara,Africa,3684032,117600
|
134 |
+
Uruguay,Montevideo,South America,3422794,181034
|
135 |
+
Mongolia,Ulaanbaatar,Asia,3398366,1564110
|
136 |
+
Moldova,Chisinau,Europe,3272996,33846
|
137 |
+
Puerto Rico,San Juan,North America,3252407,8870
|
138 |
+
Bosnia and Herzegovina,Sarajevo,Europe,3233526,51209
|
139 |
+
Albania,Tirana,Europe,2842321,28748
|
140 |
+
Jamaica,Kingston,North America,2827377,10991
|
141 |
+
Armenia,Yerevan,Asia,2780469,29743
|
142 |
+
Lithuania,Vilnius,Europe,2750055,65300
|
143 |
+
Gambia,Banjul,Africa,2705992,10689
|
144 |
+
Qatar,Doha,Asia,2695122,11586
|
145 |
+
Botswana,Gaborone,Africa,2630296,582000
|
146 |
+
Namibia,Windhoek,Africa,2567012,825615
|
147 |
+
Gabon,Libreville,Africa,2388992,267668
|
148 |
+
Lesotho,Maseru,Africa,2305825,30355
|
149 |
+
Slovenia,Ljubljana,Europe,2119844,20273
|
150 |
+
Guinea-Bissau,Bissau,Africa,2105566,36125
|
151 |
+
North Macedonia,Skopje,Europe,2093599,25713
|
152 |
+
Latvia,Riga,Europe,1850651,64559
|
153 |
+
Equatorial Guinea,Malabo,Africa,1674908,28051
|
154 |
+
Trinidad and Tobago,Port-of-Spain,North America,1531044,5130
|
155 |
+
Bahrain,Manama,Asia,1472233,765
|
156 |
+
Timor-Leste,Dili,Asia,1341296,14874
|
157 |
+
Estonia,Tallinn,Europe,1326062,45227
|
158 |
+
Mauritius,Port Louis,Africa,1299469,2040
|
159 |
+
Cyprus,Nicosia,Europe,1251488,9251
|
160 |
+
Eswatini,Mbabane,Africa,1201670,17364
|
161 |
+
Djibouti,Djibouti,Africa,1120849,23200
|
162 |
+
Reunion,Saint-Denis,Africa,974052,2511
|
163 |
+
Fiji,Suva,Oceania,929766,18272
|
164 |
+
Comoros,Moroni,Africa,836774,1862
|
165 |
+
Guyana,Georgetown,South America,808726,214969
|
166 |
+
Bhutan,Thimphu,Asia,782455,38394
|
167 |
+
Solomon Islands,Honiara,Oceania,724273,28896
|
168 |
+
Macau,Concelho de Macau,Asia,695168,30
|
169 |
+
Luxembourg,Luxembourg,Europe,647599,2586
|
170 |
+
Montenegro,Podgorica,Europe,627082,13812
|
171 |
+
Suriname,Paramaribo,South America,618040,163820
|
172 |
+
Cape Verde,Praia,Africa,593149,4033
|
173 |
+
Western Sahara,El Aaiún,Africa,575986,266000
|
174 |
+
Malta,Valletta,Europe,533286,316
|
175 |
+
Maldives,Malé,Asia,523787,300
|
176 |
+
Brunei,Bandar Seri Begawan,Asia,449002,5765
|
177 |
+
Bahamas,Nassau,North America,409984,13943
|
178 |
+
Belize,Belmopan,North America,405272,22966
|
179 |
+
Guadeloupe,Basse-Terre,North America,395752,1628
|
180 |
+
Iceland,Reykjavík,Europe,372899,103000
|
181 |
+
Martinique,Fort-de-France,North America,367507,1128
|
182 |
+
Vanuatu,Port-Vila,Oceania,326740,12189
|
183 |
+
Mayotte,Mamoudzou,Africa,326101,374
|
184 |
+
French Polynesia,Papeete,Oceania,306279,4167
|
185 |
+
French Guiana,Cayenne,South America,304557,83534
|
186 |
+
New Caledonia,Nouméa,Oceania,289950,18575
|
187 |
+
Barbados,Bridgetown,North America,281635,430
|
188 |
+
Sao Tome and Principe,São Tomé,Africa,227380,964
|
189 |
+
Samoa,Apia,Oceania,222382,2842
|
190 |
+
Curacao,Willemstad,North America,191163,444
|
191 |
+
Saint Lucia,Castries,North America,179857,616
|
192 |
+
Guam,Hagåtña,Oceania,171774,549
|
193 |
+
Kiribati,Tarawa,Oceania,131232,811
|
194 |
+
Grenada,Saint George's,North America,125438,344
|
195 |
+
Micronesia,Palikir,Oceania,114164,702
|
196 |
+
Jersey,Saint Helier,Europe,110778,116
|
197 |
+
Seychelles,Victoria,Africa,107118,452
|
198 |
+
Tonga,Nuku‘alofa,Oceania,106858,747
|
199 |
+
Aruba,Oranjestad,North America,106445,180
|
200 |
+
Saint Vincent and the Grenadines,Kingstown,North America,103948,389
|
201 |
+
United States Virgin Islands,Charlotte Amalie,North America,99465,347
|
202 |
+
Antigua and Barbuda,Saint John’s,North America,93763,442
|
203 |
+
Isle of Man,Douglas,Europe,84519,572
|
204 |
+
Andorra,Andorra la Vella,Europe,79824,468
|
205 |
+
Dominica,Roseau,North America,72737,751
|
206 |
+
Cayman Islands,George Town,North America,68706,264
|
207 |
+
Bermuda,Hamilton,North America,64184,54
|
208 |
+
Guernsey,Saint Peter Port,Europe,63301,78
|
209 |
+
Greenland,Nuuk,North America,56466,2166086
|
210 |
+
Faroe Islands,Tórshavn,Europe,53090,1393
|
211 |
+
Northern Mariana Islands,Saipan,Oceania,49551,464
|
212 |
+
Saint Kitts and Nevis,Basseterre,North America,47657,261
|
213 |
+
Turks and Caicos Islands,Cockburn Town,North America,45703,948
|
214 |
+
American Samoa,Pago Pago,Oceania,44273,199
|
215 |
+
Sint Maarten,Philipsburg,North America,44175,34
|
216 |
+
Marshall Islands,Majuro,Oceania,41569,181
|
217 |
+
Liechtenstein,Vaduz,Europe,39327,160
|
218 |
+
Monaco,Monaco,Europe,36469,2
|
219 |
+
San Marino,San Marino,Europe,33660,61
|
220 |
+
Gibraltar,Gibraltar,Europe,32649,6
|
221 |
+
Saint Martin,Marigot,North America,31791,53
|
222 |
+
British Virgin Islands,Road Town,North America,31305,151
|
223 |
+
Palau,Ngerulmud,Oceania,18055,459
|
224 |
+
Cook Islands,Avarua,Oceania,17011,236
|
225 |
+
Anguilla,The Valley,North America,15857,91
|
226 |
+
Nauru,Yaren,Oceania,12668,21
|
227 |
+
Wallis and Futuna,Mata-Utu,Oceania,11572,142
|
228 |
+
Tuvalu,Funafuti,Oceania,11312,26
|
229 |
+
Saint Barthelemy,Gustavia,North America,10967,21
|
230 |
+
Saint Pierre and Miquelon,Saint-Pierre,North America,5862,242
|
231 |
+
Montserrat,Brades,North America,4390,102
|
232 |
+
Falkland Islands,Stanley,South America,3780,12173
|
233 |
+
Niue,Alofi,Oceania,1934,260
|
234 |
+
Tokelau,Nukunonu,Oceania,1871,12
|
235 |
+
Vatican City,Vatican City,Europe,510,1
|