Week 7 — Python for Accounting Data

Your launchpad. Everything you did in Excel has a Python line. Here is the path through it.

This is the table of contents for Week 7. The eight trainers below are self-paced notebook-style pages — you type a line of real Python, run it in your browser, and see what happens. Walk them in order. Then the deck, the Lab, and the Homework pull it together.

Yes, this is a lot. You have AI to help. Here is the path.

Week 7 covers what a computer-science intro spreads across half a semester — types, file paths, conditionals, loops, functions, reading files — plus a first look at pandas. That is intentional. The real skill this week is taking on a large, unfamiliar technical task with AI in the loop, which is exactly how this work happens on the job.

So use the help. Every trainer has a built-in tutor (it coaches, it will not hand you the answer). Every Lab and Homework section carries a copy-able starter prompt. And the rule stays the same as always: stretch and try the core moves by hand first, then let AI explain what you could not get on your own. Do not paste code you cannot explain.

When something breaks — and it will, the Homework debug task is built to break — you have two legitimate options. (1) Download the file and look at it yourself. (2) Paste the error into ChatGPT or Gemini and work through it together. Both are fine. Pick one and keep going.

The trainers, in order

Start at the top and work down. Each one is short, runs in your browser, and maps a Python move onto a spreadsheet move you already know.

ready open it now
  1. 1 Types ready The four core types (int, float, str, bool), and why money math needs round(x, 2) — floating-point division comes out long. Excel bridge: the value in a cell, and number formatting.
  2. 2 File paths ready How to point at a file — and why a Windows path and a Mac path look different. This is the thing that bites first when you load real data. Excel bridge: the file reference behind File > Open.
  3. 3 Conditionals ready if / elif / else, and combining tests with and / or, the logic that decides what happens to each row. Excel bridge: =IF(...), AND(), OR(), and a nested IF becomes elif.
  4. 4 Loops ready A for loop does the same step to every item, and an accumulator builds a running total as it goes. One loop replaces dragging a formula down a thousand rows. Excel bridge: dragging a formula down every row; a running-total column; SUMIF.
  5. 5 Functions ready Define a calculation once, name it, and call it as many times as you want — with a docstring that says what it does. Build one yourself and check it against hidden tests. Excel bridge: a named formula you write once and reuse everywhere.
  6. 6 Reading files ready Open data three ways: read() for the whole thing, readlines() for a list of lines, and pd.read_csv() for a table, and call a function you already defined. Excel bridge: File > Open, three ways.
  7. 6.5 Accumulator bridge ready A side-by-side: an Excel running-total column next to the Python that does the same thing with +=, then .cumsum(). Watch the two stay in step. Excel bridge: the running-total column you drag down.
  8. 7 pandas bridge ready A first, light look at the table library — filter, group, and combine data frames. We keep it shallow this week; Project 2 goes deeper. Excel bridge: AutoFilter, a PivotTable, and XLOOKUP.

Rung 6.5 (the accumulator bridge) sits between loops and reading files — it reinforces the loop idea against a live Excel column, so open it once you have done loops.

The deliverables

The trainers are practice. These three are the week itself — the lecture to watch, the Lab to build, and the Homework to submit.

Lecture
Week 7 deck
The interactive slides — what is Python, the Excel-to-Python bridges, and where each trainer fits. Start here for the big picture.
Lab (graded)
Lab 7 — guided build
A Colab notebook you fill in: function stubs, an accumulator, and a light read of real AR data. Opens as a Canvas New Quiz with the notebook deliverable.
Homework (graded)
Homework 7 — the stretch
Ten questions plus the file work: read inherited code, debug a mixed-type column, and shape data for a chart. Opens as a Canvas New Quiz.
How to use this page. Watch the deck for the map. Walk the trainers top to bottom at your own pace — they are practice, not graded. Then do the Lab and the Homework, which is where the points are. Keep the AI tutor open the whole time, and remember the rule: try it by hand first, then ask it to explain.

Week 7 of ACCTG 5150, Accounting Analytics. Trainers run real Python in your browser (sandboxed, nothing leaves your machine).