Spaces:
Sleeping
Sleeping
| import pandas as pd | |
| def get_country(data_frame): | |
| country = data_frame["Country"].values | |
| return country | |
| def get_country_stats(data_frame, attribute, stat_type): | |
| if stat_type == "highest": | |
| idx = data_frame[attribute].idxmax() | |
| if stat_type == "lowest": | |
| idx = data_frame[attribute].idxmin() | |
| country= data_frame["Country"][idx] | |
| attribute_result = data_frame[attribute][idx] | |
| result = {country: attribute_result.item()} | |
| return result | |
| # continents_stats = data_frame.[attribute].gg(total_attribute = 'sum') | |
| # if stat_type == "highest": | |
| # continent = continents_stats.idxmax().item() | |
| # value = continents_stats.max().item() | |
| # return {continent: value} | |
| # elif stat_type == "lowest": | |
| # continent = continents_stats.idxmin().item() | |
| # value = continents_stats.min().item() | |
| # return {continent: value} | |