Week 7, Python and pandas for Accounting Data

ACCTG 6155, MAcc Analytics, Fall 2026. Twelve trainers that run real Python in your browser. Nothing to install.

These are optional. Here is where to start.

If you have never written Python, do three before the lab: Types, Conditionals and Functions. Do Column types and cleaning before the homework. The rest are there when you want them, and each one builds on the ones above it.

Every trainer has checked tasks at the bottom. Check runs tests, some of them hidden, so a function has to work for any input, not just the one you tried.

When something breaks. Read the last line of the error first. Then either look at your code again, or click Ask about this error. The tutor on these pages can see the code you are working on and the error you got. It points at the line and asks you a question. It will not write the answer.

The trainers, in order

  1. 1 Types do first The four core types, int, float, str and bool, why money math comes out long, and why True counts as a number. Excel bridge: the value in a cell, and number formatting.
  2. 2 File paths Why a path written on Windows breaks on a Mac, and the pathlib fix that works on both. Excel bridge: a file reference in a formula.
  3. 3 Reading errors Six errors you will see this week, broken on purpose. Read the last line first, then the line number, then fix it. Excel bridge: the #NAME? and #N/A cells you already know.
  4. 4 Conditionals do first if, else, and, or and elif, and why the order of the tests decides the answer. Excel bridge: =IF(), AND(), OR() and a nested IF.
  5. 5 Loops A for loop runs one step once per row. The accumulator, enumerate, and stopping early. Excel bridge: dragging a formula down every row.
  6. 6 Functions do first def, arguments, return and docstrings, then calling one function from another and a default argument. Excel bridge: a named formula like =B2*C2.
  7. 7 Reading files One CSV read three ways, a total built by hand from the lines, then the same answer in one pandas call. Excel bridge: File, Open.
  8. 8 Accumulator bridge The running-total column as a loop: a count, then an accumulated-depreciation schedule. Excel bridge: =COUNTIF() and a running-total column.
  9. 9 Column types and cleaning before the homework Why one text value turns a whole column into text, what errors="coerce" quietly throws away, and how to clean first. Excel bridge: a column Excel stored as text.
  10. 10 pandas bridge A DataFrame as a table you drive with code: AutoSum, AutoFilter, a PivotTable and a lookup, each one line. Excel bridge: the whole Excel toolbar.
  11. 11 Merge and group Left and inner merges, the row-count check after every merge, grouping, and the open balance on a small wholesale ledger. Excel bridge: XLOOKUP down a whole table, and a PivotTable.
  12. 12 Merging a table with itself Looking up a manager in the same employee table, and finding pairs of rows that share something. Excel bridge: a lookup into the same sheet.

This week's other pieces

Slides
Week 7 deck
What Python is, and the Excel move behind each Python line.
Reference card
Lab 7 functions
Every Lab 7 function's specification in one place, with the code in color.
In Canvas
Lab 7 and Homework 7
Both are Colab notebooks you upload in Canvas. Both are due Monday, October 19, 11:59 PM MT.

Reset all Week 7 trainers Clears every check mark on this page. Check marks are kept in this browser only, so a different browser or device starts clean.