Skip to content

Instantly share code, notes, and snippets.

@gccollect
gccollect / plutus_statement_to_csv.py
Last active October 23, 2024 15:26
Convert Plutus pdf statement to csv file with running balance
import re
import sys
import pandas as pd
import pdfplumber
re_transaction = re.compile(
r'(Transaction|Card Transaction|Service Fee|Card Transfer)[\n\s](\d{4}/\d{2}/\d{2}, \d{2}:\d{2})\s+(-?\s?.\d*.?\d{0,2})\n?(.*)')
re_deposit = re.compile(r'(Card Deposit|Deposit)[\n\s](\d{4}/\d{2}/\d{2}, \d{2}:\d{2})\s+(.\d*.?\d{0,2})()')
re_page = re.compile(r'\n\d{1,2}/\d{1,2}/\d{4} \d+ / \d+')