Mutual Fund CAS PDF Statement Parser
A Python tool/library that extracts data from Consolidated Account Statement (CAS) PDFs (https://github.com/ukkit/processCASpdf) — tested with KFintech — into CSV, DataFrame, JSON, or a list of dictionaries.
Requirements
- Python >= 3.9
- uv package manager
- Internet connection (fetches AMFI scheme data on each run)
Installation
git clone https://github.com/ukkit/processCASpdf.git
cd processCASpdf
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync
Usage
from processCASpdf import ProcessPDF
pdf = ProcessPDF("CAS_statement.pdf", password="your_pdf_password")
filename(required) - Path to the CAS PDF file.password(optional) - PDF password (usually your PAN in uppercase).
Output Formats
Call get_pdf_data(format) with one of: "csv" (default), "df", "json", "dicts".
pdf.get_pdf_data("csv") # writes CAS_data_<timestamp>.csv to current directory
df = pdf.get_pdf_data("df") # returns pandas DataFrame
js = pdf.get_pdf_data("json") # returns JSON string
rec = pdf.get_pdf_data("dicts") # returns list of dicts
Output Fields
| Field | Type | Description |
|---|---|---|
fund_name |
str | Mutual fund scheme name |
isin |
str | ISIN code (e.g. INF...) |
scheme_code |
str | AMFI scheme code; empty if lookup fails |
folio_num |
str | Folio number |
date |
str | Transaction date (e.g. 01-Jan-2025) |
txn |
str | Buy, Sell, IDCW_PAYOUT, or IDCW_REINVEST |
amount |
float | Transaction amount (INR) |
units |
float | Units transacted (0.0 for IDCW_PAYOUT, which allots no units) |
nav |
float | NAV at time of transaction (0.0 for IDCW_PAYOUT) |
balance_units |
float | Unit balance after transaction (0.0 for IDCW_PAYOUT, since it isn't printed on that row) |
narration |
str | Raw transaction line text as it appeared in the PDF |
Example
import logging
from processCASpdf import ProcessPDF
logging.basicConfig(level=logging.DEBUG) # optional
pdf = ProcessPDF("MyCAS.pdf", password="ABCDE1234F")
df = pdf.get_pdf_data("df")
df[df["fund_name"].str.contains("HDFC", case=False)]
df.to_excel("cas_transactions.xlsx", index=False)
Troubleshooting
| Problem | Likely cause / fix |
|---|---|
PDFPasswordIncorrect |
Wrong or missing password. Try your PAN in uppercase. |
| No transactions extracted | Enable debug logging to inspect raw PDF text. |
scheme_code is empty |
ISIN not found in current AMFI data (new or discontinued scheme). |
| Network error on startup | AMFI data fetch requires outbound HTTPS. |
Development
uv sync --group dev
uv run ruff check .
uv run ruff format .
uv run mypy processCASpdf.py
uv run pre-commit install
Credits
Based on camspdf.py originally written by Suhas Bharadwaj.
Metadata
Release files for processCASpdf 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| processcaspdf-0.3.2.tar.gz | 117.6 kB | Without provenance | Details for processcaspdf-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| processcaspdf-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for processcaspdf-0.3.2-py3-none-any.whl |
Total release size: 126.1 kB
Release files / processcaspdf-0.3.2.tar.gz
| Download URL | processcaspdf-0.3.2.tar.gz |
|---|---|
| Size | 117.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ceeacc6a0f175777141ff1f3563bf811f2fbe239134757327d6f9cf7b48493f
|
|
BLAKE2b-256 checksum How to use checksums |
33e2ea7e8f76a8559acb1aef86e2335e10b8d2c4ba7cfe90d7e27761936dce59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / processcaspdf-0.3.2-py3-none-any.whl
| Download URL | processcaspdf-0.3.2-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1691b9dd4215b27fe9fb47c7b8f9e68b3cc741a02839c974bfc6162dc668d9c7
|
|
BLAKE2b-256 checksum How to use checksums |
735cdee85d281a3b6ef45da419d6487c04738861fa58bd919b7e7f9be7524b74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for processCASpdf 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.