Skip to content

Instantly share code, notes, and snippets.

@kerbrose
Created June 5, 2025 00:34
Show Gist options
  • Select an option

  • Save kerbrose/5c4062bf7d4751805edd980669e5daa3 to your computer and use it in GitHub Desktop.

Select an option

Save kerbrose/5c4062bf7d4751805edd980669e5daa3 to your computer and use it in GitHub Desktop.
import pandas as pd
from dash import Dash, dash_table, dcc, html
import plotly.express as px
countries = [
{
'name': 'Egypt',
'imf_economy_classification': {
'2013-10-01': 'Emerging and developing economies',
'2014-10-01': 'Emerging and developing economies',
'2015-10-01': 'Emerging and developing economies',
'2016-10-01': 'Emerging and developing economies',
'2017-10-01': 'Emerging and developing economies',
'2018-10-01': 'Emerging and developing economies',
'2019-10-01': 'Emerging and developing economies',
'2020-10-01': 'Emerging and developing economies',
'2021-10-01': 'Emerging and developing economies',
'2022-10-01': 'Emerging and developing economies',
'2023-10-01': 'Emerging and developing economies',
'2024-10-01': 'Emerging and developing economies',
},
'world_bank_gdp_data': {
'2013-12-31': 288434108527.132,
'2014-12-31': 305595408895.265,
'2015-12-31': 329366576819.407,
'2016-12-31': 332441717791.411,
'2017-12-31': 248362771739.13,
'2018-12-31': 262588632526.73,
'2019-12-31': 318678815489.749,
'2020-12-31': 383817841547.099,
'2021-12-31': 424671765455.704,
'2022-12-31': 476747720364.742,
'2023-12-31': 396002496996.96,
},
'world_bank_per_capita_gdp_data': {
'2013-12-31': 3025.52563552448,
'2014-12-31': 3133.39102265541,
'2015-12-31': 3306.98159414141,
'2016-12-31': 3270.6287768197,
'2017-12-31': 2395.10333299491,
'2018-12-31': 2484.70315630508,
'2019-12-31': 2962.98892023003,
'2020-12-31': 3511.11381026379,
'2021-12-31': 3827.35415374308,
'2022-12-31': 4233.30783744856,
'2023-12-31': 3457.45691570455,
},
'world_bank_gnp_data': {
'2013-12-31': 5158009241782.3,
'2014-12-31': 5320080502962.35,
'2015-12-31': 5590712881892.96,
'2016-12-31': 5857044108633.25,
'2017-12-31': 6072755185730.55,
'2018-12-31': 6360605807671.2,
'2019-12-31': 6640330659395.9,
'2020-12-31': 6912830491656.55,
'2021-12-31': 7143198706290.31,
'2022-12-31': 7583195360000,
'2023-12-31': 7781407669373.64,
},
'world_bank_trade_balance_data': {
'2013-12-31': 49085271317.8295,
'2014-12-31': 43529411764.7059,
'2015-12-31': 43423180592.9919,
'2016-12-31': 34392638036.8098,
'2017-12-31': 37289402173.913,
'2018-12-31': 47225661226.7867,
'2019-12-31': 53041002277.9043,
'2020-12-31': 47872738615.0967,
'2021-12-31': 44850223072.0204,
'2022-12-31': 71927051671.7325,
'2023-12-31': 75644808538.0457,
},
'world_bank_balance_of_payments_data': {
'2013-12-31': -3533700000,
'2014-12-31': -5954500000,
'2015-12-31': -17243300000,
'2016-12-31': -20493900000,
'2017-12-31': -7939700000,
'2018-12-31': -7698166088.33333,
'2019-12-31': -10221895259.0833,
'2020-12-31': -14235956908.6917,
'2021-12-31': -18610828181.5,
'2022-12-31': -10536555731.2,
'2023-12-31': -12564268977.3833,
},
'world_bank_gdp_contribution_by_sector_data': {
'agriculture': {
'2013-12-31': 11.2743481427611,
'2014-12-31': 11.3377054875794,
'2015-12-31': 11.3940610667634,
'2016-12-31': 11.7693176039343,
'2017-12-31': 10.9863805629257,
'2018-12-31': 10.8302490891945,
'2019-12-31': 10.6971354360257,
'2020-12-31': 11.1668238972142,
'2021-12-31': 11.4369326139485,
'2022-12-31': 10.9457534758116,
'2023-12-31': 11.5659207037428,
},
'industry': {
'2013-12-31': 39.8869573974657,
'2014-12-31': 39.8903338554165,
'2015-12-31': 36.6302015379086,
'2016-12-31': 32.4559535988041,
'2017-12-31': 34.3958680933773,
'2018-12-31': 35.32987502651,
'2019-12-31': 35.8254243818749,
'2020-12-31': 32.3694440960636,
'2021-12-31': 31.1876357692741,
'2022-12-31': 32.7114314706066,
'2023-12-31': 32.1190419225225,
},
'services': {
'2013-12-31': 52.3007422739897,
'2014-12-31': 52.3209910853315,
'2015-12-31': 53.1705469980756,
'2016-12-31': 54.4832812972001,
'2017-12-31': 53.1699505200109,
'2018-12-31': 51.6422459876293,
'2019-12-31': 50.7617521105431,
'2020-12-31': 52.0271088870756,
'2021-12-31': 52.4773049906802,
'2022-12-31': 51.4288499571067,
'2023-12-31': 51.2802666269023,
},
},
'world_bank_unemployment_rate_data': {
'2013-12-31': 13.154,
'2014-12-31': 13.105,
'2015-12-31': 13.052,
'2016-12-31': 12.45,
'2017-12-31': 11.767,
'2018-12-31': 9.855,
'2019-12-31': 7.851,
'2020-12-31': 7.974,
'2021-12-31': 7.441,
'2022-12-31': 7.344,
'2023-12-31': 7.334,
},
'world_bank_consumer_price_index_data': {
'2013-12-31': 9.46971981064921,
'2014-12-31': 10.0702154687481,
'2015-12-31': 10.370490343517,
'2016-12-31': 13.813606214829,
'2017-12-31': 29.5066083940039,
'2018-12-31': 14.4014657807422,
'2019-12-31': 9.15279959324804,
'2020-12-31': 5.04493288977539,
'2021-12-31': 5.21404940513043,
'2022-12-31': 13.8956609775178,
'2023-12-31': 33.8847763115546,
},
'world_bank_total_reserves_data': {
'2013-12-31': 16536236826.4074,
'2014-12-31': 14926998051.7397,
'2015-12-31': 15858887325.7756,
'2016-12-31': 23642691705.9678,
'2017-12-31': 36400242555.8255,
'2018-12-31': 41839242990.7097,
'2019-12-31': 44568837112.0669,
'2020-12-31': 38972812936.6708,
'2021-12-31': 39824388217.3615,
'2022-12-31': 32143926008.4607,
'2023-12-31': 33070180836.1374,
},
'world_bank_total_reserves_no_gold_data': {
'2013-12-31': 13608097326.4074,
'2014-12-31': 11995212051.7397,
'2015-12-31': 13282027325.7756,
'2016-12-31': 20858154705.9678,
'2017-12-31': 33213917118.8055,
'2018-12-31': 38609411065.1377,
'2019-12-31': 40685367785.5569,
'2020-12-31': 34094946983.7178,
'2021-12-31': 35089750384.1185,
'2022-12-31': 24823644492.5027,
'2023-12-31': 24695657741.4334,
},
'world_bank_total_reserves_gold_data': {
'2013-12-31': 2928139500,
'2014-12-31': 2931786000,
'2015-12-31': 2576860000,
'2016-12-31': 2784537000,
'2017-12-31': 3186325437.02,
'2018-12-31': 3229831925.57201,
'2019-12-31': 3883469326.51,
'2020-12-31': 4877865952.953,
'2021-12-31': 4734637833.243,
'2022-12-31': 7320281515.958,
'2023-12-31': 8374523094.704,
},
'world_bank_currency_exchange_rate_data': {
'2013-12-31': 6.870325,
'2014-12-31': 7.07760856060606,
'2015-12-31': 7.69125833333333,
'2016-12-31': 10.0254007885465,
'2017-12-31': 17.7825335150636,
'2018-12-31': 17.7672904218107,
'2019-12-31': 16.7705818428763,
'2020-12-31': 15.7591729166667,
'2021-12-31': 15.6445272777113,
'2022-12-31': 19.1604397412204,
'2023-12-31': 30.6264136980311,
'2024-12-31': 45.29926,
},
'chat_gpt_government_budget_balance_data': {
'2013-12-31': -13.7,
'2014-12-31': -12.8,
'2015-12-31': -11.5,
'2016-12-31': -12.2,
'2017-12-31': -10.9,
'2018-12-31': -9.8,
'2019-12-31': -8,
'2020-12-31': -7.4,
'2021-12-31': -7.1,
'2022-12-31': -6.1,
'2023-12-31': -7,
},
'chat_gpt_gross_domestic_debt_data': {
'2013-12-31': 144.4,
'2014-12-31': 169.9,
'2015-12-31': 208.4,
'2016-12-31': 261.8,
'2017-12-31': 313.9,
'2018-12-31': 345.2,
'2019-12-31': 373.3,
'2020-12-31': 361.7,
'2021-12-31': 342.5,
'2022-12-31': 318.9,
'2023-12-31': 313.9,
},
'chat_gpt_external_debt_data': {
'2013-12-31': 43.2 ,
'2014-12-31': 46.1 ,
'2015-12-31': 48.8 ,
'2016-12-31': 55.1 ,
'2017-12-31': 82.9 ,
'2018-12-31': 96.6 ,
'2019-12-31': 112.7,
'2020-12-31': 123.5,
'2021-12-31': 137.4,
'2022-12-31': 155.2,
'2023-12-31': 168.0,
},
},
{
'name': 'Morocco',
'imf_economy_classification': {
'2013-10-01': 'Emerging and developing economies',
'2014-10-01': 'Emerging and developing economies',
'2015-10-01': 'Emerging and developing economies',
'2016-10-01': 'Emerging and developing economies',
'2017-10-01': 'Emerging and developing economies',
'2018-10-01': 'Emerging and developing economies',
'2019-10-01': 'Emerging and developing economies',
'2020-10-01': 'Emerging and developing economies',
'2021-10-01': 'Emerging and developing economies',
'2022-10-01': 'Emerging and developing economies',
'2023-10-01': 'Emerging and developing economies',
'2024-10-01': 'Emerging and developing economies',
},
'world_bank_gdp_data': {
'2013-12-31': 115739287305.08,
'2014-12-31': 119130841411.664,
'2015-12-31': 110413823841.592,
'2016-12-31': 111572947004.917,
'2017-12-31': 118540573367.844,
'2018-12-31': 127341147581.818,
'2019-12-31': 128920266409.458,
'2020-12-31': 121353645057.144,
'2021-12-31': 142022058447.231,
'2022-12-31': 130951926351.241,
'2023-12-31': 144417103249.646,
},
'world_bank_per_capita_gdp_data': {
'2013-12-31': 3379.7431640625,
'2014-12-31': 3435.40698242188,
'2015-12-31': 3146.24780273438,
'2016-12-31': 3140.85546875,
'2017-12-31': 3296.52661132813,
'2018-12-31': 3501.69799804688,
'2019-12-31': 3508.09765625,
'2020-12-31': 3268.0302734375,
'2021-12-31': 3785.93627929688,
'2022-12-31': 3455.39624023438,
'2023-12-31': 3771.4462890625,
},
'world_bank_gnp_data': {
'2013-12-31': 5158009241782.3,
'2014-12-31': 5320080502962.35,
'2015-12-31': 5590712881892.96,
'2016-12-31': 5857044108633.25,
'2017-12-31': 6072755185730.55,
'2018-12-31': 6360605807671.2,
'2019-12-31': 6640330659395.9,
'2020-12-31': 6912830491656.55,
'2021-12-31': 7143198706290.31,
'2022-12-31': 7583195360000,
'2023-12-31': 7781407669373.64,
},
'world_bank_trade_balance_data': {
'2013-12-31': 35014914037.2784,
'2014-12-31': 35897680523.6335,
'2015-12-31': 33119569273.8522,
'2016-12-31': 34291493550.4303,
'2017-12-31': 38651885813.4308,
'2018-12-31': 43077520359.3569,
'2019-12-31': 43952860516.0238,
'2020-12-31': 37369771251.448,
'2021-12-31': 47060549921.4328,
'2022-12-31': 58681916332.2068,
'2023-12-31': 61741317207.8401,
},
'world_bank_balance_of_payments_data': {
'2013-12-31': -7844020644.72759,
'2014-12-31': -6597266905.28948,
'2015-12-31': -2160696677.40238,
'2016-12-31': -4179669586.72829,
'2017-12-31': -3677255013.68365,
'2018-12-31': -6205208861.72044,
'2019-12-31': -4406759940.68629,
'2020-12-31': -1368382876.41721,
'2021-12-31': -3348692437.5592,
'2022-12-31': -4800285754.42935,
'2023-12-31': -891222001.152936,
},
'world_bank_gdp_contribution_by_sector_data': {
'agriculture': {
'2013-12-31': 12.3583661932506,
'2014-12-31': 10.3531465249527,
'2015-12-31': 11.7961931846113,
'2016-12-31': 10.3219651103177,
'2017-12-31': 11.1602887992375,
'2018-12-31': 11.3055402401365,
'2019-12-31': 10.8424017370039,
'2020-12-31': 10.6636401420592,
'2021-12-31': 11.9779439009277,
'2022-12-31': 9.8181364510228,
'2023-12-31': 11.0646198674555,
},
'industry': {
'2013-12-31': 24.1531288845084,
'2014-12-31': 25.8132675090419,
'2015-12-31': 25.6226817262287,
'2016-12-31': 25.685104578574,
'2017-12-31': 25.405454806575,
'2018-12-31': 25.2413538068182,
'2019-12-31': 25.2499524130611,
'2020-12-31': 26.0436433872433,
'2021-12-31': 25.9539090511005,
'2022-12-31': 25.9113093904963,
'2023-12-31': 24.5583104066127,
},
'services': {
'2013-12-31': 47.6140626235819,
'2014-12-31': 54.7549862499925,
'2015-12-31': 52.2029571874719,
'2016-12-31': 53.3932404781727,
'2017-12-31': 53.0987601129781,
'2018-12-31': 53.070813570865,
'2019-12-31': 53.4781212999139,
'2020-12-31': 53.1903022793513,
'2021-12-31': 51.7882000339975,
'2022-12-31': 54.6300123707497,
'2023-12-31': 54.2776955468177,
},
},
'world_bank_unemployment_rate_data': {
'2013-12-31': 9.23,
'2014-12-31': 9.7,
'2015-12-31': 9.46,
'2016-12-31': 9.3,
'2017-12-31': 9.223,
'2018-12-31': 9.271,
'2019-12-31': 9.194,
'2020-12-31': 11.223,
'2021-12-31': 10.576,
'2022-12-31': 9.494,
'2023-12-31': 9.044,
},
'world_bank_consumer_price_index_data': {
'2013-12-31': 1.88065466724086,
'2014-12-31': 0.442310053557048,
'2015-12-31': 1.5579071134626,
'2016-12-31': 1.63531114327064,
'2017-12-31': 0.754663249323619,
'2018-12-31': 1.80391671141896,
'2019-12-31': 0.303386036590383,
'2020-12-31': 0.705968661338261,
'2021-12-31': 1.40195883962006,
'2022-12-31': 6.65704202759067,
'2023-12-31': 6.09114152504141,
},
'world_bank_total_reserves_data': {
'2013-12-31': 18797794939.8508,
'2014-12-31': 20272045638.8487,
'2015-12-31': 22749566243.6606,
'2016-12-31': 25096263443.799,
'2017-12-31': 26189585939.2967,
'2018-12-31': 24461023093.2087,
'2019-12-31': 26412762236.8499,
'2020-12-31': 35997639773.4544,
'2021-12-31': 35648269520.1527,
'2022-12-31': 32314245660.4383,
'2023-12-31': 36327701787.7523,
},
'world_bank_total_reserves_no_gold_data': {
'2013-12-31': 17944085607.4903,
'2014-12-31': 19416547581.2066,
'2015-12-31': 21996701264.8606,
'2016-12-31': 24282138815.762,
'2017-12-31': 25268147247.8717,
'2018-12-31': 23549728686.8952,
'2019-12-31': 25329860211.4799,
'2020-12-31': 34653006798.9454,
'2021-12-31': 34354119831.1337,
'2022-12-31': 31025606470.8918,
'2023-12-31': 34861268999.0963,
},
'world_bank_total_reserves_gold_data': {
'2013-12-31': 853709332.3605,
'2014-12-31': 855498057.642101,
'2015-12-31': 752864978.799999,
'2016-12-31': 814124628.037003,
'2017-12-31': 921438691.424999,
'2018-12-31': 911294406.3135,
'2019-12-31': 1082902025.37,
'2020-12-31': 1344632974.509,
'2021-12-31': 1294149689.019,
'2022-12-31': 1288639189.5465,
'2023-12-31': 1466432788.656,
},
'world_bank_currency_exchange_rate_data': {
'2013-12-31': 8.4055039167443,
'2014-12-31': 8.40633668826152,
'2015-12-31': 9.76434827950111,
'2016-12-31': 9.8074760315025,
'2017-12-31': 9.6919978888289,
'2018-12-31': 9.38610242091972,
'2019-12-31': 9.61707609950743,
'2020-12-31': 9.49684732221969,
'2021-12-31': 8.98848402414138,
'2022-12-31': 10.1606602430359,
'2023-12-31': 10.1314260970897,
'2024-12-31': 9.94235921679198,
},
'chat_gpt_government_budget_balance_data': {
'2013-12-31': -5.5,
'2014-12-31': -4.9,
'2015-12-31': -4.2,
'2016-12-31': -4.1,
'2017-12-31': -3.7,
'2018-12-31': -3.7,
'2019-12-31': -4.1,
'2020-12-31': -7.9,
'2021-12-31': -5.9,
'2022-12-31': -5.3,
'2023-12-31': -4.5,
},
'chat_gpt_gross_domestic_debt_data': {
'2013-12-31': 64.47 ,
'2014-12-31': 64.48 ,
'2015-12-31': 67.04 ,
'2016-12-31': 71.43 ,
'2017-12-31': 76.99 ,
'2018-12-31': 77.70 ,
'2019-12-31': 87.67 ,
'2020-12-31': 98.49 ,
'2021-12-31': 93.67 ,
'2022-12-31': 100.33 ,
'2023-12-31': 91.1 ,
},
'chat_gpt_external_debt_data': {
'2013-12-31': 32.5,
'2014-12-31': 35.1,
'2015-12-31': 38.7,
'2016-12-31': 42.3,
'2017-12-31': 46.8,
'2018-12-31': 51.2,
'2019-12-31': 56.7,
'2020-12-31': 65.8,
'2021-12-31': 63.1,
'2022-12-31': 64.8,
'2023-12-31': 42.3,
},
},
{
'name': 'Tunisia',
'imf_economy_classification': {
'2013-10-01': 'Emerging and developing economies',
'2014-10-01': 'Emerging and developing economies',
'2015-10-01': 'Emerging and developing economies',
'2016-10-01': 'Emerging and developing economies',
'2017-10-01': 'Emerging and developing economies',
'2018-10-01': 'Emerging and developing economies',
'2019-10-01': 'Emerging and developing economies',
'2020-10-01': 'Emerging and developing economies',
'2021-10-01': 'Emerging and developing economies',
'2022-10-01': 'Emerging and developing economies',
'2023-10-01': 'Emerging and developing economies',
'2024-10-01': 'Emerging and developing economies',
},
'world_bank_gdp_data': {
'2013-12-31': 48685446413.953,
'2014-12-31': 50271812920.612,
'2015-12-31': 45779494041.9295,
'2016-12-31': 44360072680.4477,
'2017-12-31': 42163530590.9462,
'2018-12-31': 42686504459.801,
'2019-12-31': 41905642418.825,
'2020-12-31': 42491780918.361,
'2021-12-31': 46812290143.344,
'2022-12-31': 44579761022.8993,
'2023-12-31': 48529595416.6533,
},
'world_bank_per_capita_gdp_data': {
'2013-12-31': 4369.79345826358,
'2014-12-31': 4458.97895464547,
'2015-12-31': 4014.94773686432,
'2016-12-31': 3847.80354448809,
'2017-12-31': 3619.03247319953,
'2018-12-31': 3628.10366464236,
'2019-12-31': 3528.87213306798,
'2020-12-31': 3548.65363663803,
'2021-12-31': 3885.28166485296,
'2022-12-31': 3678.40023411347,
'2023-12-31': 3977.69516639644,
},
'world_bank_gnp_data': {
'2013-12-31': 961813726154.635,
'2014-12-31': 981338000000,
'2015-12-31': 1028299401876.23,
'2016-12-31': 1035273894750.7,
'2017-12-31': 1086056138625.85,
'2018-12-31': 1119799485886,
'2019-12-31': 1152033311642.65,
'2020-12-31': 1075390502550.45,
'2021-12-31': 1158057344937.54,
'2022-12-31': 1175564680768.14,
'2023-12-31': 1215488033663.54,
},
'world_bank_trade_balance_data': {
'2013-12-31': 21854753431.1837,
'2014-12-31': 21590469318.3324,
'2015-12-31': 17579251895.7497,
'2016-12-31': 16987820950.6092,
'2017-12-31': 17593023135.6624,
'2018-12-31': 19416540385.2933,
'2019-12-31': 19256190207.7846,
'2020-12-31': 16145881854.3016,
'2021-12-31': 19673161286.2131,
'2022-12-31': 22476730329.4792,
'2023-12-31': 25178795584.0227,
},
'world_bank_balance_of_payments_data': {
'2013-12-31': -3878661667.32493,
'2014-12-31': -4463103950.9918,
'2015-12-31': -3923736697.89078,
'2016-12-31': -3783414285.93598,
'2017-12-31': -4222408216.82838,
'2018-12-31': -4607847184.77695,
'2019-12-31': -3373037344.72417,
'2020-12-31': -2554750409.23013,
'2021-12-31': -2770055367.89955,
'2022-12-31': -3969241926.02495,
'2023-12-31': -1110513299.87519,
},
'world_bank_gdp_contribution_by_sector_data': {
'agriculture': {
'2013-12-31': 7.96930864809374,
'2014-12-31': 8.57165956609159,
'2015-12-31': 9.20592301747619,
'2016-12-31': 8.5254177646665,
'2017-12-31': 8.986045690927,
'2018-12-31': 9.88852551876126,
'2019-12-31': 9.76625873287073,
'2020-12-31': 10.3917002295357,
'2021-12-31': 10.1462824713298,
'2022-12-31': 10.7958851488668,
'2023-12-31': 9.47322064564395,
},
'industry': {
'2013-12-31': 29.1379467288349,
'2014-12-31': 27.1288836396189,
'2015-12-31': 24.8967313718372,
'2016-12-31': 24.0074541201361,
'2017-12-31': 23.624101204276,
'2018-12-31': 23.6862252235906,
'2019-12-31': 23.2353115777678,
'2020-12-31': 21.5120069019708,
'2021-12-31': 23.4077944951435,
'2022-12-31': 24.8648816572109,
'2023-12-31': 23.5120701753455,
},
'services': {
'2013-12-31': 58.023672140101,
'2014-12-31': 57.5059874486204,
'2015-12-31': 58.945784735786,
'2016-12-31': 59.702065971293,
'2017-12-31': 60.2679109708219,
'2018-12-31': 59.4591341366813,
'2019-12-31': 59.9417090281883,
'2020-12-31': 60.1899882930928,
'2021-12-31': 59.8609185157099,
'2022-12-31': 61.5690994590932,
'2023-12-31': 62.1070510941353,
},
},
'world_bank_unemployment_rate_data': {
'2013-12-31': 15.934,
'2014-12-31': 14.259,
'2015-12-31': 15.159,
'2016-12-31': 15.557,
'2017-12-31': 15.33,
'2018-12-31': 15.459,
'2019-12-31': 17.153,
'2020-12-31': 17.656,
'2021-12-31': 16.611,
'2022-12-31': 15.3,
'2023-12-31': 15.106,
},
'world_bank_consumer_price_index_data': {
'2013-12-31': 5.31623531326689,
'2014-12-31': 4.62555099534031,
'2015-12-31': 4.437371273215,
'2016-12-31': 3.62939937384381,
'2017-12-31': 5.30884839565844,
'2018-12-31': 7.30759176031652,
'2019-12-31': 6.72007532863799,
'2020-12-31': 5.63415115897625,
'2021-12-31': 5.706350208307,
'2022-12-31': 8.30646124447623,
'2023-12-31': 9.32899597507865,
},
'world_bank_total_reserves_data': {
'2013-12-31': 7550027499.83122,
'2014-12-31': 7498010302.87675,
'2015-12-31': 7559201960.29189,
'2016-12-31': 6137077790.03259,
'2017-12-31': 6143986079.65126,
'2018-12-31': 5661370258.89029,
'2019-12-31': 7919981404.82365,
'2020-12-31': 9810630874.82627,
'2021-12-31': 8845557076.37304,
'2022-12-31': 8094326708.95378,
'2023-12-31': 9239745488.47506,
},
'world_bank_total_reserves_no_gold_data': {
'2013-12-31': 7287446499.83122,
'2014-12-31': 7235102302.87675,
'2015-12-31': 7328121960.29189,
'2016-12-31': 5887271590.03259,
'2017-12-31': 5861349079.65126,
'2018-12-31': 5381970558.89029,
'2019-12-31': 7587967404.82365,
'2020-12-31': 9394588874.82627,
'2021-12-31': 8445135076.37304,
'2022-12-31': 7695609708.95378,
'2023-12-31': 8786017488.47506,
},
'world_bank_total_reserves_gold_data': {
'2013-12-31': 262581000,
'2014-12-31': 262908000,
'2015-12-31': 231080000,
'2016-12-31': 249806200,
'2017-12-31': 282637000,
'2018-12-31': 279399700,
'2019-12-31': 332014000,
'2020-12-31': 416042000,
'2021-12-31': 400421999.999999,
'2022-12-31': 398717000,
'2023-12-31': 453728000,
},
'world_bank_currency_exchange_rate_data': {
'2013-12-31': 1.62465833333333,
'2014-12-31': 1.697675,
'2015-12-31': 1.961625,
'2016-12-31': 2.14803333333333,
'2017-12-31': 2.419425,
'2018-12-31': 2.64686666666667,
'2019-12-31': 2.93443333333333,
'2020-12-31': 2.81235833333333,
'2021-12-31': 2.79446666666667,
'2022-12-31': 3.1036,
'2023-12-31': 3.10616666666667,
'2024-12-31': 3.10745,
},
'chat_gpt_government_budget_balance_data': {
'2013-12-31': -5.4,
'2014-12-31': -5,
'2015-12-31': -5.3,
'2016-12-31': -6.3,
'2017-12-31': -5.9,
'2018-12-31': -5.6,
'2019-12-31': -6.1,
'2020-12-31': -11.4,
'2021-12-31': -7.3,
'2022-12-31': -7.8,
'2023-12-31': -7.5,
},
'chat_gpt_gross_domestic_debt_data': {
'2013-12-31': 22.5,
'2014-12-31': 25.1,
'2015-12-31': 28.3,
'2016-12-31': 32.7,
'2017-12-31': 38.9,
'2018-12-31': 45.6,
'2019-12-31': 52.1,
'2020-12-31': 60.4,
'2021-12-31': 68.7,
'2022-12-31': 75.3,
'2023-12-31': 82.1,
},
'chat_gpt_external_debt_data': {
'2013-12-31': 20.4,
'2014-12-31': 22.5,
'2015-12-31': 25.1,
'2016-12-31': 28.3,
'2017-12-31': 32.7,
'2018-12-31': 38.9,
'2019-12-31': 42.0,
'2020-12-31': 43.0,
'2021-12-31': 41.0,
'2022-12-31': 41.3,
'2023-12-31': 44.2,
},
},
{
'name': 'Algeria',
'imf_economy_classification': {
'2013-10-01': 'Emerging and developing economies',
'2014-10-01': 'Emerging and developing economies',
'2015-10-01': 'Emerging and developing economies',
'2016-10-01': 'Emerging and developing economies',
'2017-10-01': 'Emerging and developing economies',
'2018-10-01': 'Emerging and developing economies',
'2019-10-01': 'Emerging and developing economies',
'2020-10-01': 'Emerging and developing economies',
'2021-10-01': 'Emerging and developing economies',
'2022-10-01': 'Emerging and developing economies',
'2023-10-01': 'Emerging and developing economies',
'2024-10-01': 'Emerging and developing economies',
},
'world_bank_gdp_data': {
'2013-12-31': 229701430292.157,
'2014-12-31': 238942664192.59,
'2015-12-31': 187493855609.345,
'2016-12-31': 180763839522.151,
'2017-12-31': 189880896903.073,
'2018-12-31': 194554483655.528,
'2019-12-31': 193459662090.677,
'2020-12-31': 164873415325.201,
'2021-12-31': 186231205262.082,
'2022-12-31': 225638456572.143,
'2023-12-31': 247626161016.414,
},
'world_bank_per_capita_gdp_data': {
'2013-12-31': 5979.60138960585,
'2014-12-31': 6094.69392314956,
'2015-12-31': 4685.05902729002,
'2016-12-31': 4424.98529027556,
'2017-12-31': 4554.66753957828,
'2018-12-31': 4577.21029180491,
'2019-12-31': 4468.45341883656,
'2020-12-31': 3743.5419522929,
'2021-12-31': 4160.55926736925,
'2022-12-31': 4961.55257664733,
'2023-12-31': 5364.02795022731,
},
'world_bank_gnp_data': {
'2013-12-31': 82630902458.7343,
'2014-12-31': 85951673613.696,
'2015-12-31': 87487195070.0526,
'2016-12-31': 88838204960.3713,
'2017-12-31': 90679098974.7191,
'2018-12-31': 93017625110.4991,
'2019-12-31': 94330681850.0747,
'2020-12-31': 85161166893.7973,
'2021-12-31': 89841364984.5183,
'2022-12-31': 92781663289.3199,
'2023-12-31': 92252654577.5825,
},
'world_bank_trade_balance_data': {
'2013-12-31': 70746581763.019,
'2014-12-31': 65994736570.1917,
'2015-12-31': 38489004322.7411,
'2016-12-31': 33417246978.2851,
'2017-12-31': 38609773040.5942,
'2018-12-31': 45570702426.4208,
'2019-12-31': 39481135535.1468,
'2020-12-31': 25613416650.3651,
'2021-12-31': 43660727771.3446,
'2022-12-31': 69516903679.1619,
'2023-12-31': 58488151164.9929,
},
'world_bank_balance_of_payments_data': {
'2013-12-31': 1187894322.86364,
'2014-12-31': -9264322928.81106,
'2015-12-31': -27037635153.4304,
'2016-12-31': -26204046336.6022,
'2017-12-31': -22067518023.9626,
'2018-12-31': -16905642520.7904,
'2019-12-31': -16954294028.7879,
'2020-12-31': -18187037296.1337,
'2021-12-31': -4512873533.10143,
'2022-12-31': 19433089540.8216,
'2023-12-31': 6359214534.06637,
},
'world_bank_gdp_contribution_by_sector_data': {
'agriculture': {
'2013-12-31': 9.12007464194984,
'2014-12-31': 9.40707440856373,
'2015-12-31': 10.5327896965018,
'2016-12-31': 11.0683130545794,
'2017-12-31': 11.0318809304784,
'2018-12-31': 11.2438301354995,
'2019-12-31': 11.4791798857164,
'2020-12-31': 12.8341693887186,
'2021-12-31': 11.2354345605089,
'2022-12-31': 10.6131779036563,
'2023-12-31': 13.086784145579,
},
'industry': {
'2013-12-31': 39.7438543670176,
'2014-12-31': 38.5614138325673,
'2015-12-31': 32.7565009315894,
'2016-12-31': 32.205164049828,
'2017-12-31': 33.4766949498416,
'2018-12-31': 35.3432586054084,
'2019-12-31': 33.5743211841578,
'2020-12-31': 30.0235803787213,
'2021-12-31': 36.3214812457704,
'2022-12-31': 43.0480574822469,
'2023-12-31': 37.7570495314503,
},
'services': {
'2013-12-31': 46.7933663667477,
'2014-12-31': 47.9036022305248,
'2015-12-31': 52.1103711658838,
'2016-12-31': 52.3939905220294,
'2017-12-31': 51.2221393515536,
'2018-12-31': 49.4261444653673,
'2019-12-31': 50.4800694011749,
'2020-12-31': 52.8041887035021,
'2021-12-31': 48.4879581553143,
'2022-12-31': 42.7851541004335,
'2023-12-31': 45.6157814802809,
},
},
'world_bank_unemployment_rate_data': {
'2013-12-31': 9.82,
'2014-12-31': 10.207,
'2015-12-31': 11.206,
'2016-12-31': 10.202,
'2017-12-31': 12,
'2018-12-31': 12.137,
'2019-12-31': 12.259,
'2020-12-31': 14.057,
'2021-12-31': 13.63,
'2022-12-31': 12.346,
'2023-12-31': 11.701,
},
'world_bank_consumer_price_index_data': {
'2013-12-31': 3.25423910998847,
'2014-12-31': 2.91692692067458,
'2015-12-31': 4.78444700693889,
'2016-12-31': 6.39769480268757,
'2017-12-31': 5.59111590961664,
'2018-12-31': 4.26999020467084,
'2019-12-31': 1.95176821052892,
'2020-12-31': 2.41513094083414,
'2021-12-31': 7.22606307415477,
'2022-12-31': 9.26551551551553,
'2023-12-31': 9.32217375928322,
},
'world_bank_total_reserves_data': {
'2013-12-31': 201436604411.914,
'2014-12-31': 186350590140.833,
'2015-12-31': 150595236894.628,
'2016-12-31': 120788088861.403,
'2017-12-31': 104852543743.412,
'2018-12-31': 87382910154.0942,
'2019-12-31': 71795950714.9485,
'2020-12-31': 59434389109.5108,
'2021-12-31': 56211005199.3665,
'2022-12-31': 71852290093.8578,
'2023-12-31': 81216738411.6242,
},
'world_bank_total_reserves_no_gold_data': {
'2013-12-31': 194712107088.462,
'2014-12-31': 179617718599.046,
'2015-12-31': 144677455937.501,
'2016-12-31': 114390744334.26,
'2017-12-31': 97614427695.3787,
'2018-12-31': 80227698867.583,
'2019-12-31': 63297610714.9485,
'2020-12-31': 48882051109.5108,
'2021-12-31': 46054847199.3665,
'2022-12-31': 61739377093.8577,
'2023-12-31': 69708546411.6242,
},
'world_bank_total_reserves_gold_data': {
'2013-12-31': 6724497323.452,
'2014-12-31': 6732871541.78702,
'2015-12-31': 5917780957.12698,
'2016-12-31': 6397344527.14301,
'2017-12-31': 7238116048.03331,
'2018-12-31': 7155211286.5112,
'2019-12-31': 8498340000,
'2020-12-31': 10552338000,
'2021-12-31': 10156158000,
'2022-12-31': 10112913000.0001,
'2023-12-31': 11508192000,
},
'world_bank_currency_exchange_rate_data': {
'2013-12-31': 79.3684,
'2014-12-31': 80.5790166666667,
'2015-12-31': 100.691433333333,
'2016-12-31': 109.443066666667,
'2017-12-31': 110.973016666667,
'2018-12-31': 116.593791666667,
'2019-12-31': 119.353558333333,
'2020-12-31': 126.7768,
'2021-12-31': 135.064058333333,
'2022-12-31': 141.994975,
'2023-12-31': 135.842933333333,
'2024-12-31': 134.053241666667,
},
'chat_gpt_government_budget_balance_data': {
'2013-12-31': -0.3,
'2014-12-31': -8.3,
'2015-12-31': -16.3,
'2016-12-31': -13.5,
'2017-12-31': -9.5,
'2018-12-31': -5.6,
'2019-12-31': -1.4,
'2020-12-31': -11.2,
'2021-12-31': -6.3,
'2022-12-31': 1.3,
'2023-12-31': -2.1,
},
'chat_gpt_gross_domestic_debt_data': {
'2013-12-31': 13.6,
'2014-12-31': 14.7,
'2015-12-31': 12.8,
'2016-12-31': 32.7,
'2017-12-31': 45.6,
'2018-12-31': 67.1,
'2019-12-31': 79.1,
'2020-12-31': 75.8,
'2021-12-31': 102.7,
'2022-12-31': 108.5,
'2023-12-31': 120.4,
},
'chat_gpt_external_debt_data': {
'2013-12-31': 5.2,
'2014-12-31': 5.4,
'2015-12-31': 5.6,
'2016-12-31': 5.9,
'2017-12-31': 6.2,
'2018-12-31': 6.5,
'2019-12-31': 7.1,
'2020-12-31': 7.4,
'2021-12-31': 7.1,
'2022-12-31': 7.3,
'2023-12-31': 4.8,
},
},
{
'name': 'South Africa',
'imf_economy_classification': {
'2013-10-01': 'Emerging and developing economies',
'2014-10-01': 'Emerging and developing economies',
'2015-10-01': 'Emerging and developing economies',
'2016-10-01': 'Emerging and developing economies',
'2017-10-01': 'Emerging and developing economies',
'2018-10-01': 'Emerging and developing economies',
'2019-10-01': 'Emerging and developing economies',
'2020-10-01': 'Emerging and developing economies',
'2021-10-01': 'Emerging and developing economies',
'2022-10-01': 'Emerging and developing economies',
'2023-10-01': 'Emerging and developing economies',
'2024-10-01': 'Emerging and developing economies',
},
'world_bank_gdp_data': {
'2013-12-31': 400886013595.573,
'2014-12-31': 381198869776.106,
'2015-12-31': 346709790458.563,
'2016-12-31': 323585509674.481,
'2017-12-31': 381448814653.456,
'2018-12-31': 405260723892.517,
'2019-12-31': 389330032224.269,
'2020-12-31': 337974655408.055,
'2021-12-31': 420886877628.703,
'2022-12-31': 406920004594.074,
'2023-12-31': 380699271814.508,
},
'world_bank_per_capita_gdp_data': {
'2013-12-31': 7331.65467384919,
'2014-12-31': 6856.73137092522,
'2015-12-31': 6112.27382485974,
'2016-12-31': 5651.20585165749,
'2017-12-31': 6618.33508255701,
'2018-12-31': 6914.1780318076,
'2019-12-31': 6533.71121032856,
'2020-12-31': 5580.60383075189,
'2021-12-31': 6843.39941886204,
'2022-12-31': 6523.41097815853,
'2023-12-31': 6022.5425418935,
},
'world_bank_gnp_data': {
'2013-12-31': 6932236925954.73,
'2014-12-31': 7197293853493.63,
'2015-12-31': 7426113801068.7,
'2016-12-31': 7844571297015.46,
'2017-12-31': 7914809565007.08,
'2018-12-31': 7929707697218.99,
'2019-12-31': 8013932778234.88,
'2020-12-31': 7652770088806.12,
'2021-12-31': 7906369203055.84,
'2022-12-31': 8127870538690.03,
'2023-12-31': 8568230000906.76,
},
'world_bank_trade_balance_data': {
'2013-12-31': 113768565563.408,
'2014-12-31': 110550033012.43,
'2015-12-31': 96085897668.3633,
'2016-12-31': 91109021408.9525,
'2017-12-31': 104288394992.827,
'2018-12-31': 111434691806.498,
'2019-12-31': 105906059178.622,
'2020-12-31': 93199600859.2205,
'2021-12-31': 130910965845.524,
'2022-12-31': 135795104058.468,
'2023-12-31': 124696245269.168,
},
'world_bank_balance_of_payments_data': {
'2013-12-31': -21400789698.6023,
'2014-12-31': -18344938660.4379,
'2015-12-31': -14944186632.1317,
'2016-12-31': -8521994957.00949,
'2017-12-31': -9056996805.89754,
'2018-12-31': -12159926617.7368,
'2019-12-31': -10200410538.59,
'2020-12-31': 6771399115.51677,
'2021-12-31': 15700969351.0441,
'2022-12-31': -1877973944.67041,
'2023-12-31': -6143218091.43801,
},
'world_bank_gdp_contribution_by_sector_data': {
'agriculture': {
'2013-12-31': 1.92684924597199,
'2014-12-31': 2.12574854869936,
'2015-12-31': 2.23397839045912,
'2016-12-31': 2.41418607394576,
'2017-12-31': 2.49379863849766,
'2018-12-31': 2.2607038266992,
'2019-12-31': 1.9503211452698,
'2020-12-31': 2.57866122238783,
'2021-12-31': 2.48808434399147,
'2022-12-31': 2.70990871821223,
'2023-12-31': 2.61681042406659,
},
'industry': {
'2013-12-31': 24.5517417673484,
'2014-12-31': 24.3052820058227,
'2015-12-31': 23.7323079746326,
'2016-12-31': 23.7825372977493,
'2017-12-31': 23.6105564955695,
'2018-12-31': 23.5370608392744,
'2019-12-31': 23.6220152843652,
'2020-12-31': 23.3394384079582,
'2021-12-31': 24.8691650397379,
'2022-12-31': 24.9348725792342,
'2023-12-31': 24.6196414679869,
},
'services': {
'2013-12-31': 64.0537426456394,
'2014-12-31': 64.0117818477066,
'2015-12-31': 64.1025757790295,
'2016-12-31': 63.913401523834,
'2017-12-31': 64.3304256202533,
'2018-12-31': 64.2531759654529,
'2019-12-31': 64.3473048295753,
'2020-12-31': 64.6102537818073,
'2021-12-31': 62.7333137458698,
'2022-12-31': 62.2573808399405,
'2023-12-31': 62.6102798428866,
},
},
'world_bank_unemployment_rate_data': {
'2013-12-31': 24.561,
'2014-12-31': 24.89,
'2015-12-31': 25.149,
'2016-12-31': 26.536,
'2017-12-31': 27.035,
'2018-12-31': 26.906,
'2019-12-31': 28.468,
'2020-12-31': 29.217,
'2021-12-31': 34.007,
'2022-12-31': 33.268,
'2023-12-31': 32.098,
},
'world_bank_consumer_price_index_data': {
'2013-12-31': 5.78016910069176,
'2014-12-31': 6.13282953059149,
'2015-12-31': 4.51869094892506,
'2016-12-31': 6.60290842394872,
'2017-12-31': 5.18618655524149,
'2018-12-31': 4.50987264867388,
'2019-12-31': 4.10285075461156,
'2020-12-31': 3.23238831615113,
'2021-12-31': 4.61874544887136,
'2022-12-31': 7.03987272546482,
'2023-12-31': 6.0752438457966,
},
'world_bank_total_reserves_data': {
'2013-12-31': 49708174893.5691,
'2014-12-31': 49121568380.4854,
'2015-12-31': 45887065756.7249,
'2016-12-31': 47180127300.8565,
'2017-12-31': 50722891363.2361,
'2018-12-31': 51642041966.6735,
'2019-12-31': 55055893656.867,
'2020-12-31': 55008491995.5568,
'2021-12-31': 57597149617.2517,
'2022-12-31': 60553113006.2543,
'2023-12-31': 62491675820.3129,
},
'world_bank_total_reserves_no_gold_data': {
'2013-12-31': 44863675893.5691,
'2014-12-31': 44267418380.4854,
'2015-12-31': 41619505756.7249,
'2016-12-31': 42565588000.8565,
'2017-12-31': 45499292863.2361,
'2018-12-31': 46478274116.6735,
'2019-12-31': 48919726656.867,
'2020-12-31': 47387358995.5568,
'2021-12-31': 50262146617.2517,
'2022-12-31': 53247530156.2543,
'2023-12-31': 54176079020.3129,
},
'world_bank_total_reserves_gold_data': {
'2013-12-31': 4844499000,
'2014-12-31': 4854150000,
'2015-12-31': 4267560000,
'2016-12-31': 4614539300,
'2017-12-31': 5223598500,
'2018-12-31': 5163767850,
'2019-12-31': 6136167000,
'2020-12-31': 7621133000,
'2021-12-31': 7335003000,
'2022-12-31': 7305582850,
'2023-12-31': 8315596800,
},
'world_bank_currency_exchange_rate_data': {
'2013-12-31': 9.65505606913526,
'2014-12-31': 10.8526555687831,
'2015-12-31': 12.7589308811644,
'2016-12-31': 14.7096108855267,
'2017-12-31': 13.3238014244992,
'2018-12-31': 13.2339264715833,
'2019-12-31': 14.4484270548333,
'2020-12-31': 16.4591053903333,
'2021-12-31': 14.7786782139167,
'2022-12-31': 16.3558534845,
'2023-12-31': 18.4502441785,
'2024-12-31': 18.3286575505,
},
'chat_gpt_government_budget_balance_data': {
'2013-12-31': -4.2,
'2014-12-31': -4.1,
'2015-12-31': -4.3,
'2016-12-31': -3.8,
'2017-12-31': -4.4,
'2018-12-31': -4.2,
'2019-12-31': -6,
'2020-12-31': -10.1,
'2021-12-31': -5.7,
'2022-12-31': -4.6,
'2023-12-31': -4.9,
},
'chat_gpt_gross_domestic_debt_data': {
'2013-12-31': 137.8,
'2014-12-31': 152.1,
'2015-12-31': 170.5,
'2016-12-31': 189.7,
'2017-12-31': 210.2,
'2018-12-31': 235.4,
'2019-12-31': 261.8,
'2020-12-31': 280.6,
'2021-12-31': 295.1,
'2022-12-31': 311.3,
'2023-12-31': 315.7,
},
'chat_gpt_external_debt_data': {
'2013-12-31': 136.2,
'2014-12-31': 142.5,
'2015-12-31': 148.9,
'2016-12-31': 155.3,
'2017-12-31': 162.7,
'2018-12-31': 170.1,
'2019-12-31': 185.4,
'2020-12-31': 175.8,
'2021-12-31': 163.2,
'2022-12-31': 158.3,
'2023-12-31': 163.9,
},
},
{
'name': 'United States',
'imf_economy_classification': {
'2013-10-01': 'Advanced economies',
'2014-10-01': 'Advanced economies',
'2015-10-01': 'Advanced economies',
'2016-10-01': 'Advanced economies',
'2017-10-01': 'Advanced economies',
'2018-10-01': 'Advanced economies',
'2019-10-01': 'Advanced economies',
'2020-10-01': 'Advanced economies',
'2021-10-01': 'Advanced economies',
'2022-10-01': 'Advanced economies',
'2023-10-01': 'Advanced economies',
'2024-10-01': 'Advanced economies',
},
'world_bank_gdp_data': {
'2013-12-31': 16880683000000,
'2014-12-31': 17608138000000,
'2015-12-31': 18295019000000,
'2016-12-31': 18804913000000,
'2017-12-31': 19612102000000,
'2018-12-31': 20656516000000,
'2019-12-31': 21539982000000,
'2020-12-31': 21354105000000,
'2021-12-31': 23681171000000,
'2022-12-31': 26006893000000,
'2023-12-31': 27720709000000,
},
'world_bank_per_capita_gdp_data': {
'2013-12-31': 53409.7507774372,
'2014-12-31': 55304.3155317137,
'2015-12-31': 57040.2082136605,
'2016-12-31': 58206.6141931844,
'2017-12-31': 60322.2614241747,
'2018-12-31': 63201.0458483771,
'2019-12-31': 65604.6815198734,
'2020-12-31': 64411.3731779373,
'2021-12-31': 71318.3073592183,
'2022-12-31': 78035.1753604212,
'2023-12-31': 82769.4122114216,
},
'world_bank_gnp_data': {
'2013-12-31': 17451632101000,
'2014-12-31': 18028402599000,
'2015-12-31': 18608138000000,
'2016-12-31': 18858883065000,
'2017-12-31': 19309364277984,
'2018-12-31': 19885337126559.1,
'2019-12-31': 20388762914712.8,
'2020-12-31': 19837885138789.3,
'2021-12-31': 21071266931055.2,
'2022-12-31': 21649291694340.7,
'2023-12-31': 21968702199556.5,
},
'world_bank_trade_balance_data': {
'2013-12-31': 2287922000000,
'2014-12-31': 2378545000000,
'2015-12-31': 2270622000000,
'2016-12-31': 2235558000000,
'2017-12-31': 2388260000000,
'2018-12-31': 2538089000000,
'2019-12-31': 2539391000000,
'2020-12-31': 2151139000000,
'2021-12-31': 2555430000000,
'2022-12-31': 3017379000000,
'2023-12-31': 3052469000000,
},
'world_bank_balance_of_payments_data': {
'2013-12-31': -339455000000,
'2014-12-31': -369978000000,
'2015-12-31': -408447000000,
'2016-12-31': -396219000000,
'2017-12-31': -367614000000,
'2018-12-31': -439851000000,
'2019-12-31': -441748000000,
'2020-12-31': -601207000000,
'2021-12-31': -867984000000,
'2022-12-31': -1012103000000,
'2023-12-31': -905378000000,
},
'world_bank_gdp_contribution_by_sector_data': {
'agriculture': {
'2013-12-31': 1.31815003575389,
'2014-12-31': 1.16824049198161,
'2015-12-31': 1.02890409132672,
'2016-12-31': 0.937140437714336,
'2017-12-31': 0.940362226343714,
'2018-12-31': 0.898498260790929,
'2019-12-31': 0.83262086291437,
'2020-12-31': 0.935800226701142,
'2021-12-31': 0.944732585225621,
},
'industry': {
'2013-12-31': 19.1988903588794,
'2014-12-31': 19.2684337605714,
'2015-12-31': 18.4967127664639,
'2016-12-31': 17.9368724917791,
'2017-12-31': 18.3087442284361,
'2018-12-31': 18.5195461519261,
'2019-12-31': 18.1454838448797,
'2020-12-31': 17.2676773903659,
'2021-12-31': 17.6081720747678,
},
'services': {
'2013-12-31': 75.6476660748857,
'2014-12-31': 75.580105062784,
'2015-12-31': 76.3690739266245,
'2016-12-31': 76.987521420599,
'2017-12-31': 76.5036033516448,
'2018-12-31': 76.2769100268409,
'2019-12-31': 76.6113712908395,
'2020-12-31': 77.063050443931,
'2021-12-31': 76.3995935758413,
},
},
'world_bank_unemployment_rate_data': {
'2013-12-31': 7.375,
'2014-12-31': 6.168,
'2015-12-31': 5.28,
'2016-12-31': 4.869,
'2017-12-31': 4.355,
'2018-12-31': 3.896,
'2019-12-31': 3.669,
'2020-12-31': 8.055,
'2021-12-31': 5.349,
'2022-12-31': 3.65,
'2023-12-31': 3.638,
},
'world_bank_consumer_price_index_data': {
'2013-12-31': 1.46483265562717,
'2014-12-31': 1.62222297740817,
'2015-12-31': 0.118627135552451,
'2016-12-31': 1.26158320570536,
'2017-12-31': 2.13011000365961,
'2018-12-31': 2.44258329692817,
'2019-12-31': 1.81221007526021,
'2020-12-31': 1.23358439630629,
'2021-12-31': 4.69785886363742,
'2022-12-31': 8.00279982052121,
'2023-12-31': 4.11633838374488,
},
'world_bank_total_reserves_data': {
'2013-12-31': 448508920737.711,
'2014-12-31': 434416188744.625,
'2015-12-31': 383728497570.133,
'2016-12-31': 405942428719.749,
'2017-12-31': 451285263406.24,
'2018-12-31': 449907088828.546,
'2019-12-31': 516700583371.247,
'2020-12-31': 628369715338.322,
'2021-12-31': 716152260973.711,
'2022-12-31': 706644215998.894,
'2023-12-31': 773426187289.128,
},
'world_bank_total_reserves_no_gold_data': {
'2013-12-31': 133533464073.2,
'2014-12-31': 119048483711.245,
'2015-12-31': 106539635766.333,
'2016-12-31': 106290809152.792,
'2017-12-31': 112251905534.783,
'2018-12-31': 114756990011.769,
'2019-12-31': 118437718706.204,
'2020-12-31': 133849095923.967,
'2021-12-31': 240197337193.282,
'2022-12-31': 232716637027.829,
'2023-12-31': 234110801811.752,
},
'world_bank_total_reserves_gold_data': {
'2013-12-31': 314975456664.511,
'2014-12-31': 315367705033.38,
'2015-12-31': 277188861803.8,
'2016-12-31': 299651619566.957,
'2017-12-31': 339033357871.457,
'2018-12-31': 335150098816.777,
'2019-12-31': 398262864665.043,
'2020-12-31': 494520619414.355,
'2021-12-31': 475954923780.429,
'2022-12-31': 473927578971.065,
'2023-12-31': 539315385477.376,
},
'world_bank_currency_exchange_rate_data': {
'2013-12-31': 1,
'2014-12-31': 1,
'2015-12-31': 1,
'2016-12-31': 1,
'2017-12-31': 1,
'2018-12-31': 1,
'2019-12-31': 1,
'2020-12-31': 1,
'2021-12-31': 1,
'2022-12-31': 1,
'2023-12-31': 1,
'2024-12-31': 1,
},
'chat_gpt_government_budget_balance_data': {
'2013-12-31': -4.1,
'2014-12-31': -4.1,
'2015-12-31': -3.6,
'2016-12-31': -3.9,
'2017-12-31': -3.9,
'2018-12-31': -5.4,
'2019-12-31': -5.7,
'2020-12-31': -14.9,
'2021-12-31': -12.4,
'2022-12-31': -5.5,
'2023-12-31': -6.3,
},
'chat_gpt_gross_domestic_debt_data': {
'2013-12-31': (16.7 * 1000),
'2014-12-31': (17.8 * 1000),
'2015-12-31': (18.1 * 1000),
'2016-12-31': (19.6 * 1000),
'2017-12-31': (20.5 * 1000),
'2018-12-31': (21.5 * 1000),
'2019-12-31': (22.7 * 1000),
'2020-12-31': (26.9 * 1000),
'2021-12-31': (29.6 * 1000),
'2022-12-31': (31.4 * 1000),
'2023-12-31': (33.1 * 1000),
},
'chat_gpt_external_debt_data': {
'2013-12-31': (17.1 * 1000),
'2014-12-31': (18.2 * 1000),
'2015-12-31': (19.1 * 1000),
'2016-12-31': (20.5 * 1000),
'2017-12-31': (21.7 * 1000),
'2018-12-31': (22.9 * 1000),
'2019-12-31': (24.3 * 1000),
'2020-12-31': (25.8 * 1000),
'2021-12-31': (26.9 * 1000),
'2022-12-31': (27.6 * 1000),
'2023-12-31': (28.4 * 1000),
},
},
]
# Question 01
imf_economy_classification = pd.DataFrame({i['name']: i['imf_economy_classification'] for i in countries})
imf_economy_classification2 = pd.DataFrame({
"country": ["Egypt", "Morocco", "Tunisia", "Algeria", "South Africa", "United States",],
"category": ["Emerging and developing economies", "Emerging and developing economies", "Emerging and developing economies", "Emerging and developing economies", "Emerging and developing economies", "Advanced economies", ],
"Economy Classification": ["red", "red", "red", "red", "red", "green", ],
})
color_map = {"Emerging and developing economies": "red", "Advanced economies": "green"}
color_scale = ["red", "green"]
figure_economy_classification = px.choropleth(
imf_economy_classification2,
locations="country",
locationmode="country names",
color="category",
color_discrete_map=color_map,
title="Country Economy Classification",
)
figure_economy_classification.update_layout(
autosize=False,
width=800,
)
# Question 02
world_bank_gdp_data = []
world_bank_gdp_data_without_us = []
for country in countries:
for year,gdp in country['world_bank_gdp_data'].items():
world_bank_gdp_data.append({
'country': country['name'],
'date': year,
'Gross Domestic Product(GDP)': gdp,
})
if country['name'] != 'United States':
world_bank_gdp_data_without_us.append({
'country': country['name'],
'date': year,
'Gross Domestic Product(GDP)': gdp,
})
world_bank_gdp_data = pd.DataFrame(world_bank_gdp_data)
world_bank_gdp_data_without_us = pd.DataFrame(world_bank_gdp_data_without_us)
figure_gdb = px.line(world_bank_gdp_data, x='date', y="Gross Domestic Product(GDP)", color='country')
figure_gdb_without_us = px.line(world_bank_gdp_data_without_us, x='date', y="Gross Domestic Product(GDP)", color='country')
world_bank_gdp_data.set_index('country', inplace=True)
world_bank_gdp_data['gdp_pct_change'] = world_bank_gdp_data.groupby('country')['Gross Domestic Product(GDP)'].pct_change().fillna(0)
world_bank_gdp_data['gdp_pct_change'] = world_bank_gdp_data['gdp_pct_change'] * 100
world_bank_gdp_data.reset_index(inplace=True)
figure_gdb_pct_change = px.line(
world_bank_gdp_data,
x='date',
y='gdp_pct_change',
color='country',
title='GDP Percentage Change Over Time',
)
# Question 03
world_bank_gdp_per_capita_data = []
world_bank_gdp_per_capita_data_without_us = []
for country in countries:
for year,gdpc in country['world_bank_per_capita_gdp_data'].items():
world_bank_gdp_per_capita_data.append({
'country': country['name'],
'date': year,
'Gross domestic product (GDP) per capita': gdpc,
})
if country['name'] != 'United States':
world_bank_gdp_per_capita_data_without_us.append({
'country': country['name'],
'date': year,
'Gross domestic product (GDP) per capita': gdpc,
})
world_bank_gdp_per_capita_data = pd.DataFrame(world_bank_gdp_per_capita_data)
world_bank_gdp_per_capita_data_without_us = pd.DataFrame(world_bank_gdp_per_capita_data_without_us)
figure_map_gdpc_without_us = px.choropleth(
world_bank_gdp_per_capita_data_without_us,
locations="country",
locationmode="country names",
color="Gross domestic product (GDP) per capita",
# color_discrete_map=color_map,
title="Gross domestic product (GDP) per capita",
)
world_bank_gdp_per_capita_data['gdp_per_capita_pct_change'] = world_bank_gdp_per_capita_data.groupby('country')['Gross domestic product (GDP) per capita'].pct_change().fillna(0)
world_bank_gdp_per_capita_data['gdp_per_capita_pct_change'] = world_bank_gdp_per_capita_data['gdp_per_capita_pct_change'] * 100
world_bank_gdp_per_capita_data.reset_index(inplace=True)
figure_gdp_per_capita_pct_change = px.line(
world_bank_gdp_per_capita_data,
x='date',
y='gdp_per_capita_pct_change',
color='country',
title='GDP per Capita Percentage Change Over Time',
)
figure_gdp_per_capita_pct_change.update_layout(
yaxis=dict(
title=dict(
text='GDP per Capita Percentage Change (%)',
)
),
)
# Question 04
world_bank_gnp_data = []
world_bank_gnp_data_without_us = []
for country in countries:
for year,gni in country['world_bank_gnp_data'].items():
world_bank_gnp_data.append({
'country': country['name'],
'date': year,
'Gross National Income': gni,
})
if country['name'] != 'United States':
world_bank_gnp_data_without_us.append({
'country': country['name'],
'date': year,
'Gross National Income': gni,
})
world_bank_gnp_data = pd.DataFrame(world_bank_gnp_data)
world_bank_gnp_data_without_us = pd.DataFrame(world_bank_gnp_data_without_us)
figure_map_gni_without_us = px.choropleth(
world_bank_gnp_data_without_us,
locations="country",
locationmode="country names",
color="Gross National Income",
title="Gross National Income (without US)",
)
figure_map_gni = px.choropleth(
world_bank_gnp_data,
locations="country",
locationmode="country names",
color="Gross National Income",
title="Gross National Income (with US)",
)
world_bank_gnp_data['gni_pct_change'] = world_bank_gnp_data.groupby('country')['Gross National Income'].pct_change().fillna(0)
world_bank_gnp_data['gni_pct_change'] = world_bank_gnp_data['gni_pct_change'] * 100
world_bank_gnp_data.reset_index(inplace=True)
figure_gni_pct_change = px.line(
world_bank_gnp_data,
x='date',
y='gni_pct_change',
color='country',
title='Gross National Income Percentage Change Over Time',
)
figure_gni_pct_change.update_layout(
yaxis=dict(
title=dict(
text='Gross National Income Percentage Change (%)',
)
),
)
# Question 05
world_bank_trade_balance_data = []
world_bank_trade_balance_data_without_us = []
for country in countries:
for year,trade_balance in country['world_bank_trade_balance_data'].items():
world_bank_trade_balance_data.append({
'country': country['name'],
'date': year,
'Trade Balance': trade_balance,
})
if country['name'] != 'United States':
world_bank_trade_balance_data_without_us.append({
'country': country['name'],
'date': year,
'Trade Balance': trade_balance,
})
world_bank_trade_balance_data = pd.DataFrame(world_bank_trade_balance_data)
world_bank_trade_balance_data_without_us = pd.DataFrame(world_bank_trade_balance_data_without_us)
figure_line_trade_balance = px.line(
world_bank_trade_balance_data,
x='date',
y='Trade Balance',
color='country',
title='Trade Balance of Countries',
)
figure_line_trade_balance_without_us = px.line(
world_bank_trade_balance_data_without_us,
x='date',
y='Trade Balance',
color='country',
title='Trade Balance of Countries (without US)',
)
world_bank_trade_balance_data['trade_balance_pct_change'] = world_bank_trade_balance_data.groupby('country')['Trade Balance'].pct_change().fillna(0)
world_bank_trade_balance_data['trade_balance_pct_change'] = world_bank_trade_balance_data['trade_balance_pct_change'] * 100
world_bank_trade_balance_data.reset_index(inplace=True)
figure_trade_balance_pct_change = px.line(
world_bank_trade_balance_data,
x='date',
y='trade_balance_pct_change',
color='country',
title='Trade Balance Percentage Change Over Time',
)
figure_trade_balance_pct_change.update_layout(
yaxis=dict(
title=dict(
text='Trade Balance Percentage Change (%)',
)
),
)
# Question 06
world_bank_balance_of_payments_data = []
world_bank_balance_of_payments_data_without_us = []
for country in countries:
for year, balance_of_payments in country['world_bank_balance_of_payments_data'].items():
world_bank_balance_of_payments_data.append({
'country': country['name'],
'date': year,
'Balance of Payments': balance_of_payments,
})
if country['name'] != 'United States':
world_bank_balance_of_payments_data_without_us.append({
'country': country['name'],
'date': year,
'Balance of Payments': balance_of_payments,
})
world_bank_balance_of_payments_data = pd.DataFrame(world_bank_balance_of_payments_data)
world_bank_balance_of_payments_data_without_us = pd.DataFrame(world_bank_balance_of_payments_data_without_us)
figure_map_balance_of_payments_without_us = px.choropleth(
world_bank_balance_of_payments_data_without_us,
locations="country",
locationmode="country names",
color="Balance of Payments",
title="Balance of Payments (without US)",
)
figure_map_balance_of_payments = px.choropleth(
world_bank_balance_of_payments_data,
locations="country",
locationmode="country names",
color="Balance of Payments",
title="Balance of Payments (with US)",
)
world_bank_balance_of_payments_data['balance_of_payments_pct_change'] = world_bank_balance_of_payments_data.groupby('country')['Balance of Payments'].pct_change().fillna(0)
world_bank_balance_of_payments_data['balance_of_payments_pct_change'] = world_bank_balance_of_payments_data['balance_of_payments_pct_change'] * 100
world_bank_balance_of_payments_data.reset_index(inplace=True)
figure_balance_of_payments_pct_change = px.line(
world_bank_balance_of_payments_data,
x='date',
y='balance_of_payments_pct_change',
color='country',
title='Balance of Payments Percentage Change Over Time',
)
figure_balance_of_payments_pct_change.update_layout(
yaxis=dict(
title=dict(
text='Balance of Payments Percentage Change (%)',
)
),
)
# Question 07
world_bank_gdp_contribution_by_sector_data = []
world_bank_gdp_contribution_by_sector_data_without_us = []
for country in countries:
for sector, composition in country['world_bank_gdp_contribution_by_sector_data'].items():
for year, contribution_percent in composition.items():
world_bank_gdp_contribution_by_sector_data.append({
'country': country['name'],
'date': year,
'sector': sector,
'contribution_percent': contribution_percent,
})
if country['name'] != 'United States':
world_bank_gdp_contribution_by_sector_data_without_us.append({
'country': country['name'],
'date': year,
'sector': sector,
'contribution_percent': contribution_percent,
})
world_bank_gdp_contribution_by_sector_data = pd.DataFrame(world_bank_gdp_contribution_by_sector_data)
world_bank_gdp_contribution_by_sector_data_without_us = pd.DataFrame(world_bank_gdp_contribution_by_sector_data_without_us)
figure_group_gdp_composition = []
for country in world_bank_gdp_contribution_by_sector_data['country'].unique():
figure_group_gdp_composition.append(
px.area(
world_bank_gdp_contribution_by_sector_data[world_bank_gdp_contribution_by_sector_data['country'] == country],
x='date',
y='contribution_percent',
color='sector',
title=f'GDP Contribution by Sector for {country}',
)
)
gdp_compositions_graphs = []
for i,fig in enumerate(figure_group_gdp_composition):
gdp_compositions_graphs.append(html.Div(dcc.Graph(
id=f'figure_group_gdp_composition_{i}',
figure=fig
)))
# Question 08
world_bank_unemployment_rate_data = []
for country in countries:
for year, unemployment_rate in country['world_bank_unemployment_rate_data'].items():
world_bank_unemployment_rate_data.append({
'country': country['name'],
'date': year,
'Unemployment Rate': unemployment_rate,
})
world_bank_unemployment_rate_data = pd.DataFrame(world_bank_unemployment_rate_data)
figure_line_unemployment_rate = px.line(
world_bank_unemployment_rate_data,
x='date',
y='Unemployment Rate',
color='country',
title='Unemployment Rate of Countries',
)
# Question 09
world_bank_consumer_price_index_data = []
for country in countries:
for year, cpi in country['world_bank_consumer_price_index_data'].items():
world_bank_consumer_price_index_data.append({
'country': country['name'],
'date': year,
'Consumer Price Index': cpi,
})
world_bank_consumer_price_index_data = pd.DataFrame(world_bank_consumer_price_index_data)
figure_line_consumer_price_index = px.line(
world_bank_consumer_price_index_data,
x='date',
y='Consumer Price Index',
color='country',
title='Consumer Price Index of Countries',
)
world_bank_consumer_price_index_data['cpi_pct_change'] = world_bank_consumer_price_index_data.groupby('country')['Consumer Price Index'].pct_change().fillna(0)
world_bank_consumer_price_index_data['cpi_pct_change'] = world_bank_consumer_price_index_data['cpi_pct_change'] * 100
world_bank_consumer_price_index_data.reset_index(inplace=True)
figure_cpi_pct_change = px.line(
world_bank_consumer_price_index_data,
x='date',
y='cpi_pct_change',
color='country',
title='Consumer Price Index Percentage Change Over Time',
)
figure_cpi_pct_change.update_layout(
yaxis=dict(
title=dict(
text='Consumer Price Index Percentage Change (%)',
)
)
)
# Question 10
question_10_graph = []
world_bank_total_reserves_data = []
world_bank_total_reserves_data_without_us = []
for country in countries:
for year, reserves in country['world_bank_total_reserves_data'].items():
world_bank_total_reserves_data.append({
'country': country['name'],
'date': year,
'Total Reserves': reserves,
})
if country['name'] != 'United States':
world_bank_total_reserves_data_without_us.append({
'country': country['name'],
'date': year,
'Total Reserves': reserves,
})
world_bank_total_reserves_data = pd.DataFrame(world_bank_total_reserves_data)
world_bank_total_reserves_data_without_us = pd.DataFrame(world_bank_total_reserves_data_without_us)
figure_line_total_reserves = px.line(
world_bank_total_reserves_data,
x='date',
y='Total Reserves',
color='country',
title='Total Reserves of Countries',
)
figure_line_total_reserves_without_us = px.line(
world_bank_total_reserves_data_without_us,
x='date',
y='Total Reserves',
color='country',
title='Total Reserves of Countries (without US)',
)
question_10_graph.append(html.Div(dcc.Graph(
id='figure_line_total_reserves',
figure=figure_line_total_reserves
)))
question_10_graph.append(html.Div(dcc.Graph(
id='figure_line_total_reserves_without_us',
figure=figure_line_total_reserves_without_us
)))
for country in countries:
world_bank_reserves_flatened_data = []
for year, reserves in country['world_bank_total_reserves_no_gold_data'].items():
world_bank_reserves_flatened_data.append({
'country': country['name'],
'date': year,
'Amount': reserves,
'type': 'Foreign Exchange Reserves',
})
for year, gold in country['world_bank_total_reserves_gold_data'].items():
world_bank_reserves_flatened_data.append({
'country': country['name'],
'date': year,
'Amount': gold,
'type': 'Gold Reserves',
})
world_bank_reserves_flatened_data = pd.DataFrame(world_bank_reserves_flatened_data)
figure_area_foreign_exchange_reserves = px.area(
world_bank_reserves_flatened_data,
x='date',
y='Amount',
color='type',
title=f'Total Reserves of {country["name"]}',
)
question_10_graph.append(html.Div(dcc.Graph(
id=f'figure_area_foreign_exchange_reserves_{country["name"]}',
figure=figure_area_foreign_exchange_reserves
)))
world_bank_total_reserves_data['total_reserves_pct_change'] = world_bank_total_reserves_data.groupby('country')['Total Reserves'].pct_change().fillna(0)
world_bank_total_reserves_data['total_reserves_pct_change'] = world_bank_total_reserves_data['total_reserves_pct_change'] * 100
world_bank_total_reserves_data.reset_index(inplace=True)
figure_total_reserves_pct_change = px.line(
world_bank_total_reserves_data,
x='date',
y='total_reserves_pct_change',
color='country',
title='Total Reserves Percentage Change Over Time',
)
figure_total_reserves_pct_change.update_layout(
yaxis=dict(
title=dict(
text='Total Reserves Percentage Change (%)',
)
)
)
# Question 11
world_bank_currency_exchange_rate_data = []
for country in countries:
for year, exchange_rate in country['world_bank_currency_exchange_rate_data'].items():
if country['name'] != 'United States':
world_bank_currency_exchange_rate_data.append({
'country': country['name'],
'date': year,
'Currency Exchange Rate (to USD)': exchange_rate,
})
world_bank_currency_exchange_rate_data = pd.DataFrame(world_bank_currency_exchange_rate_data)
figure_line_currency_exchange_rate = px.line(
world_bank_currency_exchange_rate_data,
x='date',
y='Currency Exchange Rate (to USD)',
color='country',
title='Currency Exchange Rate of Countries (to USD)',
)
world_bank_currency_exchange_rate_data['currency_exchange_rate_pct_change'] = world_bank_currency_exchange_rate_data.groupby('country')['Currency Exchange Rate (to USD)'].pct_change().fillna(0)
world_bank_currency_exchange_rate_data['currency_exchange_rate_pct_change'] = world_bank_currency_exchange_rate_data['currency_exchange_rate_pct_change'] * 100
world_bank_currency_exchange_rate_data.reset_index(inplace=True)
figure_line_currency_exchange_rate_pct_change = px.line(
world_bank_currency_exchange_rate_data,
x='date',
y='currency_exchange_rate_pct_change',
color='country',
title='Currency Exchange Rate Percentage Change Over Time',
)
figure_line_currency_exchange_rate_pct_change.update_layout(
yaxis=dict(
title=dict(
text='Currency Exchange Rate Percentage Change (%)',
)
)
)
# Question 12
government_budget_balance_graphs = []
for country in countries:
chat_gpt_government_budget_balance_data = []
for year, budget_balance_percent in country['chat_gpt_government_budget_balance_data'].items():
chat_gpt_government_budget_balance_data.append({
'country': country['name'],
'date': year,
'Government Budget Balance Percent': budget_balance_percent/ 100, # Convert to decimal for percentage
})
chat_gpt_government_budget_balance_data = pd.DataFrame(chat_gpt_government_budget_balance_data)
figure_bar_government_budget_balance = px.bar(
chat_gpt_government_budget_balance_data,
x='date',
y='Government Budget Balance Percent',
color='country',
title=f'Government Budget Balance Percent of GDP ({country["name"]})',
)
figure_bar_government_budget_balance.update_layout(yaxis={"tickformat": ".0%"})
government_budget_balance_graphs.append(html.Div(dcc.Graph(
id=f'figure_bar_government_budget_balance_{country["name"]}',
figure=figure_bar_government_budget_balance
)))
# Question 13
gross_domestic_debt_data_in_billion_usd = []
for country in countries:
for year, debt in country['chat_gpt_gross_domestic_debt_data'].items():
gross_domestic_debt_data_in_billion_usd.append({
'country': country['name'],
'date': year,
'Gross Domestic Debt (in billion USD)': debt
})
gross_domestic_debt_data_in_billion_usd = pd.DataFrame(gross_domestic_debt_data_in_billion_usd)
figure_gross_domestic_debt = px.line(
gross_domestic_debt_data_in_billion_usd,
x='date',
y='Gross Domestic Debt (in billion USD)',
color='country',
title='Gross Domestic Debt of Countries (in billion USD)',
)
gross_domestic_debt_data_in_billion_usd['gross_domestic_debt_pct_change'] = gross_domestic_debt_data_in_billion_usd.groupby('country')['Gross Domestic Debt (in billion USD)'].pct_change().fillna(0)
gross_domestic_debt_data_in_billion_usd['gross_domestic_debt_pct_change'] = gross_domestic_debt_data_in_billion_usd['gross_domestic_debt_pct_change'] * 100
gross_domestic_debt_data_in_billion_usd.reset_index(inplace=True)
figure_gross_domestic_debt_pct_change = px.line(
gross_domestic_debt_data_in_billion_usd,
x='date',
y='gross_domestic_debt_pct_change',
color='country',
title='Gross Domestic Debt Percentage Change Over Time',
)
figure_gross_domestic_debt_pct_change.update_layout(
yaxis=dict(
title=dict(
text='Gross Domestic Debt Percentage Change (%)',
)
)
)
# Question 14
external_debt_data_in_billion_usd = []
external_debt_data_in_billion_usd_without_us = []
for country in countries:
for year, debt in country['chat_gpt_external_debt_data'].items():
external_debt_data_in_billion_usd.append({
'country': country['name'],
'date': year,
'External Debt (in billion USD)': debt
})
if country['name'] != 'United States':
external_debt_data_in_billion_usd_without_us.append({
'country': country['name'],
'date': year,
'External Debt (in billion USD)': debt
})
external_debt_data_in_billion_usd = pd.DataFrame(external_debt_data_in_billion_usd)
external_debt_data_in_billion_usd_without_us = pd.DataFrame(external_debt_data_in_billion_usd_without_us)
figure_external_debt = px.line(
external_debt_data_in_billion_usd,
x='date',
y='External Debt (in billion USD)',
color='country',
title='External Debt of Countries (in billion USD)',
)
figure_external_debt_without_us = px.line(
external_debt_data_in_billion_usd_without_us,
x='date',
y='External Debt (in billion USD)',
color='country',
title='External Debt of Countries (without US) (in billion USD)',
)
external_debt_data_in_billion_usd['external_debt_pct_change'] = external_debt_data_in_billion_usd.groupby('country')['External Debt (in billion USD)'].pct_change().fillna(0)
external_debt_data_in_billion_usd['external_debt_pct_change'] = external_debt_data_in_billion_usd['external_debt_pct_change'] * 100
external_debt_data_in_billion_usd.reset_index(inplace=True)
figure_external_debt_pct_change = px.line(
external_debt_data_in_billion_usd,
x='date',
y='external_debt_pct_change',
color='country',
title='External Debt Percentage Change Over Time',
)
app = Dash(__name__)
app.layout = html.Div([
html.H1('Economic Project'),
html.Div(
dash_table.DataTable(imf_economy_classification.to_dict('records'), [{"name": i, "id": i} for i in imf_economy_classification.columns])
),
dcc.Graph(
id='figure_economy_classification',
figure=figure_economy_classification
),
html.H2('Gross Domestic Product (GDP)'),
dcc.Graph(
id='figure_gdb_data',
figure=figure_gdb
),
dcc.Graph(
id='figure_gdb_data_without_us',
figure=figure_gdb_without_us
),
dcc.Graph(
id='figure_gdp_pct_change',
figure=figure_gdb_pct_change
),
html.H2('Gross Domestic Product (GDP) per Capita'),
dcc.Graph(
id='figure_map_gdpc_without_us',
figure=figure_map_gdpc_without_us
),
dcc.Graph(
id='figure_map_gdpc',
figure=px.choropleth(
world_bank_gdp_per_capita_data,
locations="country",
locationmode="country names",
color="Gross domestic product (GDP) per capita",
title="Gross domestic product (GDP) per capita (with US)",
)
),
dcc.Graph(
id='figure_gdp_per_capita_pct_change',
figure=figure_gdp_per_capita_pct_change,
),
html.H2('Gross National Income (GNI)'),
dcc.Graph(
id='figure_map_gni_without_us',
figure=figure_map_gni_without_us
),
dcc.Graph(
id='figure_map_gni',
figure=figure_map_gni
),
dcc.Graph(
id='figure_gni_pct_change',
figure=figure_gni_pct_change,
),
html.H2('Trade Balance'),
dcc.Graph(
id='figure_line_trade_balance',
figure=figure_line_trade_balance
),
dcc.Graph(
id='figure_line_trade_balance_without_us',
figure=figure_line_trade_balance_without_us
),
dcc.Graph(
id='figure_trade_balance_pct_change',
figure=figure_trade_balance_pct_change,
),
html.H2('Balance of Payments'),
dcc.Graph(
id='figure_map_balance_of_payments_without_us',
figure=figure_map_balance_of_payments_without_us
),
dcc.Graph(
id='figure_map_balance_of_payments',
figure=figure_map_balance_of_payments
),
dcc.Graph(
id='figure_balance_of_payments_pct_change',
figure=figure_balance_of_payments_pct_change,
),
html.H2('GDP Composition by Sector'),
html.Div(gdp_compositions_graphs),
html.H2('The Unemployment Rate'),
dcc.Graph(
id='figure_line_unemployment_rate',
figure=figure_line_unemployment_rate
),
html.H2('Consumer Price Index'),
dcc.Graph(
id='figure_line_consumer_price_index',
figure=figure_line_consumer_price_index
),
dcc.Graph(
id='figure_cpi_pct_change',
figure=figure_cpi_pct_change
),
html.H2('Total Reserves: foreign-exchange reserves, gold reserves'),
html.Div(question_10_graph),
dcc.Graph(
id='figure_total_reserves_pct_change',
figure=figure_total_reserves_pct_change
),
html.H2('Currency Exchange Rate (to USD)'),
dcc.Graph(
id='figure_line_currency_exchange_rate',
figure=figure_line_currency_exchange_rate
),
dcc.Graph(
id='figure_line_currency_exchange_rate_pct_change',
figure=figure_line_currency_exchange_rate_pct_change
),
html.H2('Government Budget Balance percent of GDP'),
html.Div(government_budget_balance_graphs),
html.H2('Gross Domestic Debt (in billion USD)'),
dcc.Graph(
id='figure_gross_domestic_debt',
figure=figure_gross_domestic_debt
),
dcc.Graph(
id='figure_gross_domestic_debt_pct_change',
figure=figure_gross_domestic_debt_pct_change
),
html.H2('External Debt (in billion USD)'),
dcc.Graph(
id='figure_external_debt',
figure=figure_external_debt
),
dcc.Graph(
id='figure_external_debt_without_us',
figure=figure_external_debt_without_us
),
dcc.Graph(
id='figure_external_debt_pct_change',
figure=figure_external_debt_pct_change
),
])
if __name__ == "__main__":
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment