ZeraBooks open data

Forensic bank statement analysis

A Python script and checklist that first prove a set of bank statements is complete, each statement tied and each month chained to the next, then list transfers between accounts, cash withdrawals, duplicates and round amounts. The fictional sample production is missing an April statement, and the script finds the 3,664.55 gap.

Repository: github.com/ZeraBooks/forensic-bank-statement-analysis
Download: latest release (v1.0.0)
Guide: Forensic bank statement analysis on zerabooks.com explains the method with a worked example.
License: see the repository. Cite: ZeraBooks, “Forensic bank statement analysis”, https://zerabooks.github.io/data/forensic-bank-statement-analysis/

In ZeraBooks

ZeraBooks Convert proving the March and May 2025 statements to the cent; March closes at 18,240.55 and May opens at 21,905.10, so April is missing
Five statements in ZeraBooks Convert, each proven to the cent. March's closing beside May's opening shows the missing April (fictional data).

README

Forensic bank statement analysis

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.

Files

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.

How to use it

  1. Convert the statements to one CSV with the columns date (YYYY-MM-DD), description, amount (money out as a minus), balance, account and, if you have it, source_file. Keep each account's rows in the order the bank printed them.

  2. Run it:

    python3 analyze_statements.py sample/statements.csv
    
  3. 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.

  4. Work the rest of the output with checklist.md. Options: --round 1000 lists round amounts of 1,000.00 or more, --days 5 allows five days between the two sides of a transfer.

What the sample shows

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.

What it does not do

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.

FAQ

Why chain the statements if each one already ties?

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.

Why keep the source file on every row?

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.

What counts as a cash withdrawal here?

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.

Learn more

Forensic bank statement analysis on zerabooks.com, and the ZeraBooks bank statement converter that turns statement PDFs into checked rows.

License

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.