Python data analysis tool for M-PESA-style mobile money transactions
# 📱 Mobile Money Transaction Analyzer
A Python data analysis tool that processes M-PESA-style mobile money transaction data to uncover personal finance patterns, visualise spending behaviour, and flag anomalous transactions.
Built as a portfolio project to demonstrate practical data analysis skills using Python — with a focus on financial data relevant to the East African fintech context.
---
## 🎯 What This Project Does
| Feature | Description |
|---|---|
| **Data Cleaning** | Loads and validates raw transaction CSVs, handles missing values and duplicates |
| **Financial Summary** | Computes total income, expenses, and net balance across a date range |
| **Spending Breakdown** | Categorises outgoing transactions and visualises them with horizontal bar charts |
| **Monthly Cash Flow** | Compares income vs. expenses month-over-month with trend line |
| **Anomaly Detection** | Flags statistically unusual transactions using Z-score analysis |
| **Top Recipients** | Identifies the counterparties receiving the most money |
---
## 🛠️ Tech Stack
- **Python 3.10+**
- **pandas** — data loading, cleaning, grouping, and aggregation
- **matplotlib** — data visualisation and chart export
---
## 🚀 Getting Started
### 1. Clone the repository
```bash
git clone
github.com
cd mpesa-transaction-analyzer
```
### 2. Install dependencies
```bash
pip install -r requirements.txt
```
### 3. Add your transaction data
Replace `transactions.csv` with your own M-PESA export, or use the included sample dataset.
Your CSV should have these columns:
```
transaction_id, date, type, amount_kes, category, counterparty, status
```
### 4. Run the analysis
```bash
python analyze.py
```
Charts are saved automatically to the `/outputs` folder.
---
## 📊 Sample Output
```
🔍 Mobile Money Transaction Analyzer
âś… Loaded 60 valid transactions from transactions.csv
==================================================
FINANCIAL SUMMARY (KES)
=== …