Skip to main content

bankcsv

Load a folder of a bank's CSV statement exports into a single, normalised pandas.DataFrame. Overlapping downloads (the bank only lets you export a rolling window, so you end up with many overlapping files) are reconciled with a date-range replacement strategy: the most recent export wins for every date it covers.

Supported banks: Bankwest, ANZ, Macquarie, CBA.

Installation

pip install -e ".[dev]"

Usage

from bankcsv import Banking

b = Banking()
df = b.bankwest("~/iCloudDrive/Bankwest")   # folder known to be Bankwest
df = b.anz("~/Downloads")                    # folder known to be ANZ
df = b.macquarie("~/Downloads/macquarie")
df = b.cba("~/Downloads/cba")

Auto-detection

ingest walks every CSV under the given path(s) — a folder, a single .csv, or an iterable of either — and offers each file to every bank loader in turn. The first loader that parses the whole file cleanly claims it; files nothing recognises are logged and skipped. Claimed files are merged per bank and concatenated, date-sorted:

df = b.ingest(["~/iCloudDrive/Bankwest", "~/Downloads"])
df.groupby("bank").size()

Detection is by content, not filename. Loaders are tried most-specific first:

Bank Recognised by
Bankwest exact 9-column header set
Macquarie core Debit/Credit header plus ≥2 of Category, Subcategory, Original Description
CBA headerless lines matching DD/MM/YYYY,"±amount","desc","±balance"
ANZ headerless, ≥7 fields, DD/MM/YYYY in field 0 and a signed decimal in field 1

All frames use the same columns (see below), so pd.concat([...]) across banks just works. The load_bankwest / load_anz / load_macquarie / load_cba / ingest functions are also exported for direct use.

Transaction schema

Every loader (load_bankwest, load_anz, …) returns a pandas.DataFrame with the same nine columns, in this order. The columns are always present (mandatory). Required fields are additionally guaranteed to be non-null on every row; optional fields are None when the source does not provide them.

Money is normalised to a single signed amount (decimal.Decimal): credits are positive, debits negative. date is a datetime.date.

The frame is object-dtype throughout and gaps are Python None, never NaN, so Decimal columns stay exact and x is None works. An optional column that is None on every row means that bank does not expose it; call df.dropna(axis=1, how="all") for a per-bank trimmed view.

Column Obligation
bank required
date required
amount required
description required
account optional
balance optional
type optional
payee optional
note optional

Source mapping

Headerless banks are shown by column index; means the export does not carry that field (so the column is None for every row of that bank).

Column Bankwest (CSV header) ANZ (col[i]) Macquarie (CSV header) CBA (col[i])
bank "Bankwest" "ANZ" "Macquarie" "CBA"
date Transaction Date (DD/MM/YYYY) col[0] (DD/MM/YYYY) Transaction Date (DD Mon YYYY) col[0] (DD/MM/YYYY)
amount CreditDebit col[1] CreditDebit col[1]
description Narration col[2] Details col[2]
account BSB Number/Account Number col[3] (nickname; often empty) Account
balance Balance Balance col[3]
type Transaction Type
payee col[4]
note col[6]

Not carried: ANZ col[5]/col[7] (always empty); Bankwest Cheque; Macquarie Category / Subcategory / Original Description (used only for detection).

Development

pip install -e ".[dev]"
pytest

Licence

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bankcsv-0.0.2.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bankcsv-0.0.2-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file bankcsv-0.0.2.tar.gz.

File metadata

  • Download URL: bankcsv-0.0.2.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.14

File hashes

Hashes for bankcsv-0.0.2.tar.gz
Algorithm Hash digest
SHA256 80b3917eb24cd7d474b7626be050053b6135867a5772e810faa461f410fd730d
MD5 01cd6828af9338438feed63fc40d3d66
BLAKE2b-256 03afe5176bfbf346bc2b024fabfa065fd8e08a72e2794245795a549497a214ec

See more details on using hashes here.

File details

Details for the file bankcsv-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: bankcsv-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.14

File hashes

Hashes for bankcsv-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e2c0930a9380d0590c444e2eefaf46bb8f57e9b4ea6dcc66f8da9c5f793b0da9
MD5 5536f9465ac0d91d937c1f888c3ef065
BLAKE2b-256 53c8f978f8246714ac26e92b10f7a2beea8b2871962734df9241496a08bba70c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page