Stepthrough Start free

Python for spreadsheet work: total, combine and clean exports with pandas

Lesson cheat sheetOne page · US letterGoogle Colab

A free one-page Python cheat sheet for Google Colab: load pandas, total and rank customers, stack monthly exports and clean messy names and amounts.

Free, no sign-up and no email needed. It prints on one letter-size page; the whole sheet is below.

▶StepthroughFree printable cheat sheet · learn.ynteractive.com

Python for spreadsheet work: total, combine and clean exports with pandas

The three modules of the free Python for Spreadsheet Work Jump Start, practised there on real Google Colab screens.

Colab basics

Start
colab.research.google.com, New notebook.
Run
Shift+Enter runs a cell and opens a new one.
Load
import pandas as pd
Read
sales = pd.read_csv('sales.csv') (upload it in the Files panel).

Total and rank

  1. sales['amount'].sum() adds one column.
  2. totals = sales.groupby('customer')['amount'].sum()
  3. totals.sort_values(ascending=False) biggest first.

Combine monthly exports

  1. Label first: july['month'] = 'Jul' (same for each month).
  2. quarter = pd.concat([july, august, september], ignore_index=True)
  3. quarter.groupby('month', sort=False)['amount'].sum()

Clean before you total

  1. df['client'] = df['client'].str.strip().str.title()
  2. df['amount'] = df['amount'].str.replace(',', '').astype(int)
  3. df = df.drop_duplicates() after the clean-up, not before.

Good habits

  • Show the table after every change: its name on the last line.
  • Clean, then de-duplicate, then total.
  • Keep the notebook: next month only the file name changes.

Remember: Write the steps once, run them on every export: same result every time, no missed rows and no double counts.

Practice it free: Python: Total a Sales Export by Customer in Google Colab at learn.ynteractive.com/modules/python-sales-report. This sheet: learn.ynteractive.com/content/cheat-sheets/python-spreadsheet-work. Lakeside Office Supply is a made-up business from the lesson. By Robert Breen, October 24, 2026.

Practice it in the free lesson

Python: Total a Sales Export by Customer in Google Colab. A beginner Python walkthrough in the free Google Colab: put six orders in a pandas table, total the quarter and rank customers by revenue, typing every line yourself. You do every step yourself in a practice copy of Google Colab, it checks your work as you go, and “Do it for me” finishes any step you get stuck on. Free, and nothing touches your real accounts.

Start the free lesson

Or read the full step-by-step guide

Lessons on this sheet

Plain-English definitions, each with an example from a free lesson.

The full AI glossary

More cheat sheets

All free cheat sheets · All free tutorials