# Morocco Food Price Inflation & Purchasing Power Analysis
An end-to-end data analytics project scraping official Moroccan consumer price data
to analyze food inflation trends and household purchasing power from 2009 to 2026.
## Project Status
- [x] Data collection — web scraping HCP's monthly CPI bulletins (245 months, 2009–2026)
- [x] Data quality & cleaning
- [ ] Exploratory analysis
- [ ] World Bank wage/CPI comparison layer
- [ ] Power BI dashboard
## Overview
Morocco's Haut-Commissariat au Plan (HCP) publishes monthly Consumer Price Index (CPI)
bulletins, but the data is only available as human-readable Word/PDF/RTF documents —
not as a clean, analysis-ready dataset. This project builds a full pipeline to:
1. Scrape and download 17 years of official monthly CPI bulletins
2. Extract structured tables from three different file formats (.docx, .pdf, .rtf)
across multiple site-structure eras
3. Clean and validate the resulting dataset (~1,500+ rows per table)
4. (Upcoming) Combine with World Bank wage data to analyze real purchasing power —
are food prices rising faster than incomes?
## Data Sources
- **HCP (Haut-Commissariat au Plan)** — Morocco's official statistics agency.
Monthly IPC (Indice des Prix à la Consommation) bulletins, scraped directly
from hcp.ma.
- **World Bank API** — CPI, wage-and-salary-worker share, and unemployment
indicators for Morocco and regional comparison countries (planned).
## Repository Structure
```
morocco-purchasing-power/
├── README.md
├── requirements.txt
├── .gitignore
├── notebooks/
│ ├── 01_download_data.ipynb # Scraping + extraction pipeline
│ └── 02_data_quality.ipynb # Cleaning, validation, normalization
└── data/
└── processed/
├── hcp_monthly_category_clean.csv
├── hcp_yearly_category_clean.csv
└── hcp_city_indices_clean.csv
```
## Datasets
| File | Description | Rows |
|---|---|---|
| `hcp_monthly_category_clean.csv` | Month-over-month CPI by product category (15 categories) | 1,582 |
| `hcp_y …