Metadata-Version: 2.4
Name: statement_parser
Version: 0.1.2
Summary: Bank Statement Parser is a Python library designed to parse and normalize transaction data from various bank statement formats ( CSV, Excel, etc.) into a consistent and easy-to-use Pandas DataFrame. It supports multiple banks and file formats, making it a versatile tool for financial data analysis.
Author-email: Khuzema Challawala <khuzema.ac@gmail.com>
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=2.2.3
Requires-Dist: numpy>=2.0.2
Requires-Dist: xlrd>=2.0.1
Requires-Dist: openpyxl>=3.1.5
Requires-Dist: python-dateutil>=2.8.2
Provides-Extra: dev
Requires-Dist: pytest>=8.3.4; extra == "dev"
Requires-Dist: pytest-cov>=6.0.0; extra == "dev"
Requires-Dist: flake8>=7.1.2; extra == "dev"
Requires-Dist: sphinx; extra == "dev"
Dynamic: license-file

# Bank Statement Parser

![Python Version](https://img.shields.io/badge/python-3.7%2B-blue)
![License](https://img.shields.io/badge/license-MIT-green)
![PyPI Version](https://img.shields.io/pypi/v/bank-statement-parser)

**Bank Statement Parser** is a Python library designed to parse and normalize transaction data from various bank statement formats ( CSV, Excel, etc.) into a consistent and easy-to-use Pandas DataFrame. It supports multiple banks and file formats, making it a versatile tool for financial data analysis.

---

## Features

- **Multi-Format Support**: Parse bank statements from  CSV, Excel, and more.
- **Config-Driven**: All parsing behaviour is described by a config dict — no per-bank classes to maintain.
- **Resilient**: Tolerant of header spacing/punctuation changes and messy number/date formatting.
- **Consistent Output**: Normalized transaction data with standardized columns (`bank`, `created_date`, `remarks`, `amount`, `hash`).
- **Easy Integration**: Simple API for quick integration into your Python projects.
- **Extensible**: Add support for a new bank by writing config, not code.

---

## Installation

You can install the library via pip:

```bash
pip install statement_parser
```


# Usage

### Using a bundled preset

```python
from statement_parser import GenericBank, list_banks

print(list_banks())  # ['HDFC-CREDIT', 'HSBC-CREDIT', ...]

parser = GenericBank.from_builtin("HSBC-CREDIT")
df = parser.getDataFrame("path/to/statement.csv")
print(df.head())
```

### Bring your own config

No subclassing required — define a config dict and hand it to `GenericBank`:

```python
from statement_parser import GenericBank

config = {
    "file": {
        "delimiter": ",",
        "header": {
            "mode": "detect",                       # detect | fixed | none
            "match": ["date", "description", "amount"],
            "min_matches": 2,
        },
    },
    "columns": {                                    # logical -> candidate names
        "date": ["Txn Date", "Date"],
        "details": ["Description", "Narration"],
        "amount": ["Amount"],
    },
    "date_field": "date",
    "remarks": [{"field": "details"}],
    "amount": {"mode": "direct", "field": "amount"},
}

parser = GenericBank(config, bank_id="MY-BANK")
df = parser.getDataFrame("path/to/statement.csv")
print(df.head())
```

**Amount modes**: `direct` (single amount column), `signed` (amount column whose
sign is decided by a CR/DR column), or `deposit_minus_withdrawal` (separate
deposit and withdrawal columns).
