Python scripts built and deployed against live data for real business operations.
Python · Pandas · Deployed at Discover Diving (2022)
Aggregates transaction data exported from a POS system, calculates spend-based loyalty points at 2.5% of net sales, and reconciles balances across the full customer database. Output is a cleaned CSV ready to import back into the POS.
- Ingests a receipts export and existing customer database as CSVs
- Deduplicates customers and aggregates total spend and visit count
- Calculates points balance at 2.5% of net sales per customer
- Reconciles against the existing customer file — updates known customers, zeros out anyone with no recent transactions
- Exports an updated customer CSV ready for POS import
| File | Description |
|---|---|
customer_points_v1.py |
Original deployed script (2022) — iterative approach |
customer_points_v2.py |
Refactored version — vectorised Pandas, typed functions, cleaner structure |
receipts-YYYY-MM-DD-YYYY-MM-DD.csv
| Column | Description |
|---|---|
Customer name |
Customer identifier |
Net sales |
Transaction value (£) |
customers-YYYY-MM-DD.csv
| Column | Description |
|---|---|
Customer name |
Customer identifier |
Points balance |
Current points balance to be updated |
customerUpdatedPoints.csv — full customer database with recalculated
points balances.
pip install pandas
python customer_points_v2.pyUpdate the file paths in load_data() to match your CSV exports.
- Python 3
- Pandas