Forensic bank statement analysis starts by proving the set is complete: each statement must tie, opening balance plus its transactions equal to its printed closing balance, and each month's closing balance must carry into the next. Only then do you trace transfers, cash and checks. This repo has a script that runs those checks on statement rows.
| File | What it is |
|---|---|
analyze_statements.py |
Reads statement rows and reports the month chain, row-level balance breaks, possible duplicates, round-dollar items, cash withdrawals by month, and transfers matched across the listed accounts. Python 3, standard library only. |
sample/statements.csv |
A fictional production: checking account ending 4417 and savings account ending 9052, January to June 2025, with the April checking statement missing. |
checklist.md |
The analysis steps in order, as tick boxes: prove the set, then trace. |
-
Convert the statements to one CSV with the columns
date(YYYY-MM-DD),description,amount(money out as a minus),balance,accountand, if you have it,source_file. Keep each account's rows in the order the bank printed them. -
Run it:
python3 analyze_statements.py sample/statements.csv -
Fix anything in sections 1 and 2 first. A month chain break is a missing statement; a row break inside a month is usually a missed or misread line. The script exits with status 1 while either is open.
-
Work the rest of the output with
checklist.md. Options:--round 1000lists round amounts of 1,000.00 or more,--days 5allows five days between the two sides of a transfer.
Every checking statement in the sample ties to itself, yet the set is not complete:
| Statement | Opening | Closing | Chains to the prior month |
|---|---|---|---|
| January 2025 | 12,480.20 | 15,102.66 | First month |
| February 2025 | 15,102.66 | 14,388.09 | Yes |
| March 2025 | 14,388.09 | 18,240.55 | Yes |
| May 2025 | 21,905.10 | 19,770.43 | No: 3,664.55 gap |
| June 2025 | 19,770.43 | 23,016.88 | Yes |
March closes at 18,240.55 and May opens at 21,905.10, so April is missing and 3,664.55 of net activity sits in it. The script also finds a card charge posted twice on February 3, 3,200.00 of ATM withdrawals over the five months, four transfers matched between checking and savings, and two transfers totalling 5,500.00 to an account ending 7730 that is not in the production.
All figures are fictional.
It finds rows worth a look. It does not decide what a transaction means, flag fraud or give an opinion; that is the examiner's work. The statements remain the evidence and the CSV is the working file.
Because a statement that ties only proves itself. A missing month leaves every other statement correct, and only the jump between one closing balance and the next opening balance shows it.
So any figure in a schedule can be shown on the original statement page. When several banks and accounts are combined in one sheet, it is the only way back.
Rows with money out whose description contains ATM, CASH WITHDRAWAL,
WITHDRAWAL CASH or CASH OUT. Banks word these differently, so edit the CASH
pattern at the top of the script to match your statements.
Forensic bank statement analysis on zerabooks.com, and the ZeraBooks bank statement converter that turns statement PDFs into checked rows.
The content and data in this repository are licensed under
CC BY 4.0. The code (*.py) is licensed under
MIT. This is not legal advice.
Maintained by ZeraBooks.
