# EN.ATM.CO2E.PP.GD.KD CO2 emissions (kg per 2011 PPP $ of GDP) # EN.CLC.GHGR.MT.CE GHG net emissions/removals by LUCF (Mt of CO2 equivalent) # SP.POP.TOTL Population, total # NY.GDP.MKTP.CD GDP (current US$) # NY.GDP.MKTP.KD GDP (constant 2010 US$) # NY.GDP.MKTP.PP.CD GDP, PPP (current international $) # NY.GDP.MKTP.PP.KD GDP, PPP (constant 2011 international $) # NY.GDP.PCAP.CD GDP per capita (current US$) # NY.GDP.PCAP.KD GDP per capita (constant 2010 US$) # NY.GDP.PCAP.PP.CD GDP per capita, PPP (current international $) # NY.GDP.PCAP.PP.KD GDP per capita, PPP (constant 2011 international $) wb.get_countries().show() wb.get_regions().show() wb.get_series('SP.POP.TOTL', id_or_value='id') wb.get_series('SP.POP.TOTL').reset_index() # looks simple - so I need: # - GCA country to WB code conversion # - then I can just join everything and I should have all available years, so should be able to do ASOF over countries # country mapping root = 'D:\\projects\\fakta-o-klimatu\\work\\111-emise-svet-srovnani\\data' path_gca = root + '\\global-carbon-atlas\\export_20190819_2250.csv' country_map = pd.read_csv(root + '\\country_mapping.csv')[['wb', 'gca']] country_map = pd.merge(country_map, wb.get_countries()['name'].rename('wb').reset_index()) country_map.show_csv()
def test_one_region(): reg = get_regions('AFR') assert 'id' not in reg.columns assert reg.index == ['AFR'] assert_numeric_or_string(reg)
def test_two_regions(): reg = get_regions(['AFR', 'ANR']) assert 'id' not in reg.columns assert set(reg.index) == set(['AFR', 'ANR']) assert_numeric_or_string(reg)
def test_all_regions(): reg = get_regions() assert 'id' not in reg.columns assert len(reg.index) > 30 assert_numeric_or_string(reg)
def test_region_language(): reg = get_regions(['ECS'], language='fr') assert reg.name[0] == 'Europe et Asie centrale'