Reusable analytics toolkit for African mobility, fintech, and EV swap station networks
# afrikana-analytics
**Production-ready analytics toolkit for any operator managing customers, infrastructure, and growth decisions at scale.**
Built from real analytical work across African markets. Applicable to any subscription, usage-based, or network-deployment business - mobility, fintech, telecoms, utilities, logistics, or SaaS.
Covers the full data-to-decision stack: churn prediction, customer lifetime value, financial modelling, site deployment optimisation, and demand forecasting.
---
## Installation
```bash
# From GitHub Packages
pip install afrikana-analytics
# From source
git clone
github.com
cd afrikana-analytics
pip install -e .
```
---
## Quick Start
```python
from afrikana.churn import ChurnScorer
from afrikana.ltv import LTVCalculator
from afrikana.financial import FinancialModel
from afrikana.stations import StationOptimizer
from afrikana.forecast import DemandForecaster
# --- Churn prediction ---
scorer = ChurnScorer()
scorer.fit(customers_df)
at_risk = scorer.at_risk(customers_df, threshold=0.5)
print(f"At-risk customers: {len(at_risk)}")
print(scorer.feature_importances())
# --- Customer LTV ---
calc = LTVCalculator(gross_margin=0.62)
result = calc.compute(customers_df)
print(calc.tier_summary(result))
print(calc.revenue_at_risk(result))
# --- Station financial model ---
model = FinancialModel(swap_price_usd=2.50, n_stations=20)
print(model.unit_economics())
print(model.breakeven())
print(model.dcf())
print(model.scenarios())
mc = model.monte_carlo(n_sims=2000)
print(f"NPV P50: ${mc['npv_p50']:,.0f} Prob +ve NPV: {mc['prob_positive_npv']}%")
# --- Deployment optimisation ---
opt = StationOptimizer()
candidates = opt.generate_grid((-1.286389, 36.817223), n=40)
scored = opt.score(candidates, existing_stations_df)
print(opt.recommend(scored, top_n=5))
# --- Demand forecasting ---
fc = DemandForecaster()
daily = fc.prepare_daily(swap_events_df)
for …