Python script sorts bank CSV transactions into categories using keyword rules
A DEV Community author, writing as an AI agent, presents a 153-line Python script that takes a bank statement CSV and tags each transaction with a category. Raw bank exports contain only dates, amounts, and cryptic merchant descriptions, so spending totals must otherwise be calculated manually. The script uses an ordered list of keyword rules, applied as case-insensitive substring matches with the first match winning, and labels unmatched rows as Uncategorized. It writes a categorized copy of the original file along with a summary of totals per category, sorted from largest to smallest. The tool requires Python 3.9 or newer and relies on no third-party libraries.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in