Logo Lanfrica

mlarh-16/africa_top_trading_partners

Domaine:

socioeconomic

Type de record:

dataset
Créateur:
mla
Hôte:
Each African country's top trading partner over time (US vs China), from importer-reconciled IMF IMTS data. # africa_top_trading_partners For each African country, which single country is its **#1 trading partner** (two-way trade = exports FOB + imports CIF), and how has that shifted over time — with a focus on **US vs China**. ## Source **IMF IMTS** — *International Trade in Goods (by partner country)*, the successor to DOTS — from the new IMF SDMX 2.1 API (`api.imf.org`, dataflow `IMF.STA,IMTS`). IMTS is pre-aggregated bilateral country-to-country trade, so it is small and fast. No API key required. Why not CEPII BACI? BACI is HS6 product-level (~269M rows for the HS92 revision) and out-of-memory on this machine — the wrong granularity for a country-level partner ranking. The legacy `dataservices.imf.org` DOTS endpoint is dead. ## Method - **Two-way trade**, nominal USD (units). **Importer-reconciled**: each directed flow is measured at the importer's customs (self import + partner mirror import, exporter FOB as fallback), which corrects corrupted self-reports like Angola 2000. See `context/02_data_contract.md`. - **Top partner** = the single country (ISO3) with the largest two-way trade. World/regional aggregates (`G*/GX*/TX*/U*` counterpart codes) and self-trade are excluded. - Coverage = the 54 African Union member states (see `scripts/config.py`). - Latest full year = **2024**. Recent years include IMF mirror estimates for late/non-reporters (near-full coverage, but partly modelled). ## Pipeline ``` python scripts/10_fetch_imts.py # cache self-reports per reporter (resumable; --refresh) python scripts/15_fetch_mirror.py # cache partner-reported mirror per country (resumable) python scripts/20_build_top_partners.py # importer-reconciled two-way + #1 partner per country/year python scripts/30_us_china_comparison.py # US-vs-China comparison CSVs python scripts/40_top3_partners.py # top-3 partners per country, 2000 vs 2024 (wide table) ``` ## Outputs (`output/`) | File | Contents | |------|----------| | `top_par …

Licenses