Spaces:
Sleeping
Sleeping
backend changes
Browse files
backend/api/__pycache__/main.cpython-313.pyc
CHANGED
|
Binary files a/backend/api/__pycache__/main.cpython-313.pyc and b/backend/api/__pycache__/main.cpython-313.pyc differ
|
|
|
backend/api/main.py
CHANGED
|
@@ -13,19 +13,23 @@ df = home_page.process_data()
|
|
| 13 |
def home():
|
| 14 |
return home_page.home()
|
| 15 |
|
| 16 |
-
@app.get("/
|
| 17 |
def display_continents():
|
| 18 |
-
continent = home_page.
|
| 19 |
-
return continent
|
| 20 |
|
| 21 |
-
@app.get("/
|
| 22 |
-
def
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
-
@app.get("/max_population")
|
| 26 |
-
def max_population():
|
| 27 |
-
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
| 13 |
def home():
|
| 14 |
return home_page.home()
|
| 15 |
|
| 16 |
+
@app.get("/continent")
|
| 17 |
def display_continents():
|
| 18 |
+
continent = home_page.continent(df)
|
| 19 |
+
return {"continents":continent}
|
| 20 |
|
| 21 |
+
@app.get("/country")
|
| 22 |
+
def display_country():
|
| 23 |
+
country=home_page.country(df)
|
| 24 |
+
return{"country":country}
|
| 25 |
|
| 26 |
+
@app.get("/max_population/{continent_name}")
|
| 27 |
+
def max_population(continent_name:str):
|
| 28 |
+
max_population=home_page.max_population(df,continent_name)
|
| 29 |
+
return {"max_population":max_population}
|
| 30 |
|
| 31 |
+
|
| 32 |
+
@app.get("/min_population/{continent_name}")
|
| 33 |
+
def min_population(continent_name:str):
|
| 34 |
+
min_population=home_page.min_population(df,continent_name)
|
| 35 |
+
return {"min_population":min_population}
|
backend/modules/__pycache__/home_page.cpython-313.pyc
CHANGED
|
Binary files a/backend/modules/__pycache__/home_page.cpython-313.pyc and b/backend/modules/__pycache__/home_page.cpython-313.pyc differ
|
|
|
backend/modules/home_page.py
CHANGED
|
@@ -9,22 +9,20 @@ def process_data():
|
|
| 9 |
return df
|
| 10 |
|
| 11 |
def continent(df):
|
| 12 |
-
|
| 13 |
-
return continents
|
| 14 |
|
| 15 |
def country(df):
|
| 16 |
-
countries=df["Country"]
|
| 17 |
return countries
|
| 18 |
|
| 19 |
-
def max_population(continent_name):
|
| 20 |
-
continent_data =
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
return max_population_country
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
return
|
| 30 |
|
|
|
|
| 9 |
return df
|
| 10 |
|
| 11 |
def continent(df):
|
| 12 |
+
return df["Continent"].unique().tolist()
|
|
|
|
| 13 |
|
| 14 |
def country(df):
|
| 15 |
+
countries=df["Country"]
|
| 16 |
return countries
|
| 17 |
|
| 18 |
+
def max_population(df,continent_name):
|
| 19 |
+
continent_data = df[df["Continent"] == continent_name]
|
| 20 |
+
max_population = continent_data["Population"].max()
|
| 21 |
+
return max_population
|
|
|
|
| 22 |
|
| 23 |
+
|
| 24 |
+
def min_population(df,continent_name):
|
| 25 |
+
continent_data = df[df["Continent"] == continent_name]
|
| 26 |
+
min_population = continent_data["Population"].min()
|
| 27 |
+
return min_population
|
| 28 |
|