Skip to main content

Python client for BCEAO/UEMOA macroeconomic data

Project description

bceaoapi

BCEAO/UEMOA macroeconomic data in Python. No setup required.

pip install bceaoapi
from bceaoapi import BCEAO

b = BCEAO()  # connects to the public API automatically

# Senegal GDP in 2022
b.get_value("IMECO", "PIB nominal", "SENEGAL", 2022)
# → 17330.12

# Full time series
gdp = b.get_series_by("IMECO", "PIB nominal", "SENEGAL", start="2000")
gdp.plot(title="Senegal GDP (bn FCFA)")

# All 8 countries in one call
inflation = b.get_cross_country("IHPC", "Ensemble", start="2015")
inflation.plot(title="UEMOA Inflation")

Coverage

Datasets 39 (GDP, inflation, exchange rates, banking, balance of payments, public debt…)
Series 9 500+ — one per country/indicator combination
Observations 830 000+ — from 1960 to 2025
Countries BENIN · BURKINA FASO · CÔTE D'IVOIRE · GUINÉE BISSAU · MALI · NIGER · SÉNÉGAL · TOGO

Exploring available data

No series codes needed. Discover data in 3 steps:

# 1. What datasets are available?
b.list_datasets()

# 2. What indicators are in a dataset?
b.list_indicators("IHPC")
# ['Alimentation', 'Ameublement', 'Ensemble', 'Transport', ...]

# 3. Fetch
b.get_series_by("IHPC", "Ensemble", "BURKINA FASO", start="2010")

Or search by free text:

b.search("taux de change", frequency="MONTHLY")
b.search("PIB", country="MALI")

Methods

Method Returns Description
list_datasets() DataFrame All available datasets
list_countries(dataset?) list Available countries
list_indicators(dataset) list Indicators in a dataset
get_series_by(dataset, indicator, country) Series Time series by name
get_value(dataset, indicator, country, year) float Single data point
get_cross_country(dataset, indicator) DataFrame All 8 countries side by side
get_dataset(dataset, country?) DataFrame All indicators in a dataset
get_series(code) Series Series by code (e.g. KKKSR1012A0BP)
search(query) DataFrame Free-text search

start / end parameters accept a year ("2000") or an ISO date ("2000-01-31").


Error handling

from bceaoapi import AmbiguousQueryError, SeriesNotFoundError

try:
    b.get_series_by("PIBN", "PIB", "SENEGAL")
except AmbiguousQueryError as e:
    print(e)
    # 2 series match. Use a more specific label.
    # Found: [KKKSR1012A0BP] PIB marchand, [KKKSR1013A0BP] PIB non marchand

try:
    b.get_series_by("IHPC", "xxx", "MALI")
except SeriesNotFoundError as e:
    print(e)
    # Tip: use b.list_indicators('IHPC') to see available labels.

Data source

Data published by the BCEAO via edenpub.bceao.int. This package is independent and not affiliated with or endorsed by the BCEAO.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bceaoapi-0.1.1.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bceaoapi-0.1.1-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file bceaoapi-0.1.1.tar.gz.

File metadata

  • Download URL: bceaoapi-0.1.1.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for bceaoapi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2512771bba1064f102a0c6ba8de6205f2ee8d5331238c10dc9d59bbe9c4cb208
MD5 7bc4abdbdc5bf02ef14b0a1e03e72250
BLAKE2b-256 9aecbc0e3d7e107f990db819793e348a486737cfe6a507e5907f3b49a7c0fa1b

See more details on using hashes here.

File details

Details for the file bceaoapi-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bceaoapi-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for bceaoapi-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 143d271960e24c2cd23d19a545b131ff86a854ef0ed6afccb742589a00a6654a
MD5 8909360f03a87686e5746e13beefbd67
BLAKE2b-256 f2cf32c0f4aa8eb909a9d2d85cfc8158c9252517e13491c936bef9f49b4d4daa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page