The goal is to build a structured and reproducible macroeconomic analysis pipeline that retrieves, cleans, transforms, visualizes, and interprets economic data from the World Bank API.
The current analysis focuses on GDP, with inflation planned as the next macroeconomic indicator.
- GDP —
NY.GDP.MKTP.CD - Inflation —
FP.CPI.TOTL.ZG(planned)
All data is retrieved from the World Bank Open Data API.
- Country: Senegal (SN)
- Period: 1990 – 2024
senegal-macro-analysis/
│
├── data/
│ ├── raw/
│ └── processed/
│
├── notebooks/
│ └── senegal_macroeconomic_analysis.ipynb
│
├── src/
│ ├── __init__.py
│ ├── data.py
│ ├── cleaning.py
│ ├── indicators.py
│ ├── time_series.py
│ └── visualization.py
│
├── README.md
└── requirements.txt
The analysis follows a structured pipeline:
- Data collection from the World Bank API
- Data cleaning and preprocessing
- Macroeconomic indicator computation
- GDP growth rate
- CAGR / TCAM
- Moving average
- Volatility
- Rolling volatility
- Data visualization and economic interpretation
Reusable functions are implemented in the src/ directory and organized by responsibility.
src/data.py includes:
get_data→ retrieve and structure data from the World Bank API
src/cleaning.py includes:
clean_data→ clean datasets and detect/remove outliers
src/visualization.py includes:
line_plt→ time series visualizationhist_plt→ distribution analysisscat_plt→ relationship between variablesbox_plt→ outlier visualization
src/indicators.py includes:
compute_growth_rate→ compute annual percentage growthcompute_cagr→ compute compound annual growth rate over a selected periodcompute_moving_average→ smooth time-series indicators using a rolling averagecompute_volatility→ measure the instability of an indicator using standard deviationcompute_rolling_volatility→ measure how volatility evolves over time using a rolling window
src/time_series.py includes:
test_stationarity→ test whether a time series is stationary using the Augmented Dickey-Fuller test
- Build a clean data pipeline using the World Bank API
- Add data cleaning and outlier detection functions
- Add reusable visualization functions
- Refactor source code into dedicated modules
- Add GDP growth rate indicator
- Add CAGR / TCAM indicator
- Add GDP growth moving average indicator
- Add GDP growth volatility indicator
- Add GDP growth rolling volatility indicator
- Add stationarity tests for time-series analysis
- Add inflation analysis
- Analyze the relationship between GDP growth and inflation
- Add forecasting models such as ARIMA and VAR
- Build an interactive dashboard for country-level macroeconomic analysis
Clone the repository:
git clone https://github.com/MalickThaKidd/senegal-macro-analysis.git
cd senegal-macro-analysis