Skip to content

Course 4 — Card-spending analysis with CSV + LLM

Audience: students who finished Course 2 (or already know Python + Ollama) and want a complete real-world project mixing data ingestion, SQL, dashboards and a tool-using LLM agent.

Level · IntermediateTotal duration · ~6.5 hoursParts · 3Chapters · 24 (9 + 7 + 8)Stack · Streamlit + Python + SQLite + Plotly + Ollama or OpenAI

We start from a mundane file — a credit-card CSV export with 734 synthetic transactions — and build a real app that does three things:

  1. Understands the CSV: columns, date formats, debit/credit.
  2. Renders useful Plotly dashboards: monthly, by category, top merchants, recurring.
  3. Answers questions in plain English by letting an LLM write SQL and run it against a local SQLite database.

The same architecture is implemented twice — once with a local LLM (Ollama), once with the cloud (OpenAI) — sharing a Python library you can reuse on any CSV-based project.

flowchart TD
  CSV["bank CSV<br/>(data1-anonymized.csv, 734 rows)"]
  Shared["csv-llm-shared<br/>(ingest, normalize, db,<br/>categorize, dashboards)"]
  Ollama["csv-llm-ollama<br/>port 8504<br/>llama3.1:8b (local)"]
  OpenAI["csv-llm-openai<br/>port 8505<br/>gpt-4o-mini (cloud)"]
  CSV --> Shared
  Shared --> Ollama
  Shared --> OpenAI
The 3 Parts share the same Python module and the same demo CSV.
PartFocusDurationChapters
Part 1 — Project 1: Ollama (local)Build the full app with a local LLM. No API key, no cloud.~3h9
Part 2 — Project 2: OpenAI (cloud)Swap the LLM backend for the OpenAI API. 5× faster, ~$0.001/question.~1.5h7
Part 3 — Project 3: csv-llm-sharedDeep-dive into the shared Python library powering Parts 1 and 2.~2h8
  • Linear (recommended): Part 1 → Part 2 → Part 3. About 6.5 hours.
  • Just want a local app: Part 1 only.
  • Already know Ollama, prefer the cloud: skip to Part 2.
  • Library deep-dive: jump straight to Part 3.

Each Part has its own overview page with prerequisites, chapter list, and “how to read” guidance.

  • Python 3.9+ and pip.
  • Comfortable with a terminal and basic Git (git clone, git pull).
  • Roughly 6 GB of free disk space (mostly for the Ollama model in Part 1; Parts 2 and 3 are tiny).
  • The three GitHub repositories cloned side by side:
    • https://github.com/inskillflow/csv-llm-shared (mandatory for all Parts)
    • https://github.com/inskillflow/csv-llm-ollama (Part 1)
    • https://github.com/inskillflow/csv-llm-openai (Part 2)
  • Two working Streamlit apps on ports 8504 (Ollama) and 8505 (OpenAI) that load the same demo CSV.
  • 4 Plotly dashboards per app (monthly, categories, top merchants, recurring).
  • A chat tab where you can ask in natural English: “What is my biggest spending category?” — answered with a generated SQL query against SQLite.
  • A reusable shared Python module you can fork to support your own bank’s CSV.

Start with Part 1 →