File size: 5,175 Bytes
f236326 cf1a94c 85e37e1 f236326 85e37e1 f236326 85e37e1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
from csv import DictReader
PATH = "src/electricity_mix.csv"
COUNTRY_CODES = [
("๐ World", "WOR"),
("๐ช๐บ Europe", "EEE"),
("๐ฟ๐ผ Zimbabwe", "ZWE"),
("๐ฟ๐ฒ Zambia", "ZMB"),
("๐ฟ๐ฆ South Africa", "ZAF"),
("๐พ๐ช Yemen", "YEM"),
("๐ป๐ณ Vietnam", "VNM"),
("๐ป๐ช Venezuela", "VEN"),
("๐บ๐ฟ Uzbekistan", "UZB"),
("๐บ๐พ Uruguay", "URY"),
("๐บ๐ธ United States", "USA"),
("๐บ๐ฆ Ukraine", "UKR"),
("๐น๐ฟ Tanzania", "TZA"),
("๐น๐ผ Taiwan", "TWN"),
("๐น๐น Trinidad and Tobago", "TTO"),
("๐น๐ท Turkey", "TUR"),
("๐น๐ณ Tunisia", "TUN"),
("๐น๐ฒ Turkmenistan", "TKM"),
("๐น๐ฏ Tajikistan", "TJK"),
("๐น๐ญ Thailand", "THA"),
("๐น๐ฌ Togo", "TGO"),
("๐ธ๐พ Syrian Arab Republic", "SYR"),
("๐ธ๐ป El Salvador", "SLV"),
("๐ธ๐ณ Senegal", "SEN"),
("๐ธ๐ฐ Slovak Republic", "SVK"),
("๐ธ๐ฎ Slovenia", "SVN"),
("๐ธ๐ฌ Singapore", "SGP"),
("๐ธ๐ช Sweden", "SWE"),
("๐ธ๐ฉ Sudan", "SDN"),
("๐ธ๐ฆ Saudi Arabia", "SAU"),
("๐ท๐บ Russian Federation", "RUS"),
("๐ท๐ธ Serbia and Montenegro", "SCG"),
("๐ท๐ด Romania", "ROU"),
("๐ถ๐ฆ Qatar", "QAT"),
("๐ต๐พ Paraguay", "PRY"),
("๐ต๐น Portugal", "PRT"),
("๐ต๐ฑ Poland", "POL"),
("๐ต๐ฐ Pakistan", "PAK"),
("๐ต๐ญ Philippines", "PHL"),
("๐ต๐ช Peru", "PER"),
("๐ต๐ฆ Panama", "PAN"),
("๐ด๐ฒ Oman", "OMN"),
("๐ณ๐ฟ New Zealand", "NZL"),
("๐ณ๐ต Nepal", "NPL"),
("๐ณ๐ด Norway", "NOR"),
("๐ณ๐ฑ Netherlands", "NLD"),
("๐ณ๐ฎ Nicaragua", "NIC"),
("๐ณ๐ฌ Nigeria", "NGA"),
("๐ณ๐ฆ Namibia", "NAM"),
("๐ฒ๐ฟ Mozambique", "MOZ"),
("๐ฒ๐พ Malaysia", "MYS"),
("๐ฒ๐ฝ Mexico", "MEX"),
("๐ฒ๐น Malta", "MLT"),
("๐ฒ๐ณ Mongolia", "MNG"),
("๐ฒ๐ฒ Myanmar", "MMR"),
("๐ฒ๐ฐ North Macedonia", "MKD"),
("๐ฒ๐ฉ Moldova", "MDA"),
("๐ฒ๐ฆ Morocco", "MAR"),
("๐ฑ๐พ Libya", "LBY"),
("๐ฑ๐ป Latvia", "LVA"),
("๐ฑ๐บ Luxembourg", "LUX"),
("๐ฑ๐น Lithuania", "LTU"),
("๐ฑ๐ฐ Sri Lanka", "LKA"),
("๐ฑ๐ง Lebanon", "LBN"),
("๐ฐ๐ฟ Kazakhstan", "KAZ"),
("๐ฐ๐ผ Kuwait", "KWT"),
("๐ฐ๐ท South Korea", "KOR"),
("๐ฐ๐ต North Korea", "PRK"),
("๐ฐ๐ญ Cambodia", "KHM"),
("๐ฐ๐ฌ Kyrgyz Republic", "KGZ"),
("๐ฐ๐ช Kenya", "KEN"),
("๐ฏ๐ต Japan", "JPN"),
("๐ฏ๐ด Jordan", "JOR"),
("๐ฏ๐ฒ Jamaica", "JAM"),
("๐ฎ๐น Italy", "ITA"),
("๐ฎ๐ธ Iceland", "ISL"),
("๐ฎ๐ท Iran", "IRN"),
("๐ฎ๐ถ Iraq", "IRQ"),
("๐ฎ๐ณ India", "IND"),
("๐ฎ๐ฑ Israel", "ISR"),
("๐ฎ๐ช Ireland", "IRL"),
("๐ฎ๐ฉ Indonesia", "IDN"),
("๐ญ๐บ Hungary", "HUN"),
("๐ญ๐น Haiti", "HTI"),
("๐ญ๐ท Croatia", "HRV"),
("๐ญ๐ณ Honduras", "HND"),
("๐ญ๐ฐ Hong Kong", "HKG"),
("๐ฌ๐น Guatemala", "GTM"),
("๐ฌ๐ท Greece", "GRC"),
("๐ฌ๐ฎ Gibraltar", "GIB"),
("๐ฌ๐ญ Ghana", "GHA"),
("๐ฌ๐ช Georgia", "GEO"),
("๐ฌ๐ง United Kingdom", "GBR"),
("๐ฌ๐ฆ Gabon", "GAB"),
("๐ซ๐ท France", "FRA"),
("๐ซ๐ฎ Finland", "FIN"),
("๐ช๐น Ethiopia", "ETH"),
("๐ช๐ธ Spain", "ESP"),
("๐ช๐ท Eritrea", "ERI"),
("๐ช๐ฌ Egypt", "EGY"),
("๐ช๐ช Estonia", "EST"),
("๐ช๐จ Ecuador", "ECU"),
("๐ฉ๐ฟ Algeria", "DZA"),
("๐ฉ๐ด Dominican Republic", "DOM"),
("๐ฉ๐ฐ Denmark", "DNK"),
("๐ฉ๐ช Germany", "DEU"),
("๐จ๐ฟ Czech Republic", "CZE"),
("๐จ๐พ Cyprus", "CYP"),
("๐จ๐บ Cuba", "CUB"),
("๐จ๐ท Costa Rica", "CRI"),
("๐จ๐ด Colombia", "COL"),
("๐จ๐ณ China", "CHN"),
("๐จ๐ฒ Cameroon", "CMR"),
("๐จ๐ฑ Chile", "CHL"),
("๐จ๐ฎ Cote d'Ivoire", "CIV"),
("๐จ๐ญ Switzerland", "CHE"),
("๐จ๐ฌ Congo", "COG"),
("๐จ๐ฉ Democratic Republic of the Congo", "COD"),
("๐จ๐ฆ Canada", "CAN"),
("๐ง๐พ Belarus", "BLR"),
("๐ง๐ผ Botswana", "BWA"),
("๐ง๐ท Brazil", "BRA"),
("๐ง๐ด Bolivia", "BOL"),
("๐ง๐ณ Brunei", "BRN"),
("๐ง๐ฏ Benin", "BEN"),
("๐ง๐ญ Bahrain", "BHR"),
("๐ง๐ฌ Bulgaria", "BGR"),
("๐ง๐ช Belgium", "BEL"),
("๐ง๐ฉ Bangladesh", "BGD"),
("๐ง๐ฆ Bosnia and Herzegovina", "BIH"),
("๐ฆ๐ฟ Azerbaijan", "AZE"),
("๐ฆ๐บ Australia", "AUS"),
("๐ฆ๐น Austria", "AUT"),
("๐ฆ๐ท Argentina", "ARG"),
("๐ฆ๐ด Angola", "AGO"),
("๐ฆ Netherlands Antilles", "ANT"),
("๐ฆ๐ฒ Armenia", "ARM"),
("๐ฆ๐ฑ Albania", "ALB"),
("๐ฆ๐ช United Arab Emirates", "ARE")
]
def find_electricity_mix(code: str):
# TODO: Maybe more optimal to construct database at the beginning of the app
# in the same fashion as find_model
res = []
with open(PATH) as fd:
csv = DictReader(fd)
for row in csv:
res += [float(row[code])]
return res
|