Where the monthly file comes from
Read the export note and the September file, and say who made it, what it leaves out and what one row stands for.
3 parts · 2, 8 and 2 min · part 2 on a computer
Free course. Your Maestro, an AI, .
You have a Python Glossary word that builds a monthly sales report, the kind an AI assistant can help you write in an afternoon. It runs cleanly on your first file, so it is tempting to drop next month's file into the folder and send the output straight to finance. Over this course, you will work with three monthly Glossary word files in a sandbox project: September (a month finance already closed), October (a new valid month), and November (a broken file that arrives later). Before you trust a single total from September's file, you need to establish two things that the numbers alone cannot tell you: where the file came from and what one row represents.
Data provenance: more than a file name
A file name like data/sales_2026-09.csv looks self-explanatory, which leads many analysts to assume it holds every order placed in September. Knowing a dataset's provenance means knowing where it came from, how and when it was collected, and what was done to it before it reached your folder.
When you read an export note such as data/README.md, look for four facts:
- Source and owner: Which system and automated job created the file, so you know who defines its rules.
- Export time: When the snapshot was taken. Any order placed or updated in the source system after that moment is missing from the file.
- Exclusions: Which records were left out before export, such as orders cancelled prior to the cutoff.
- Units and definitions: What the numeric columns measure, including currency and whether discounts or taxes are included.
Table grain: what one row stands for
Once you know how the file was produced, verify its Glossary word: what a single row in the table represents. In sales data, one row might stand for one order, one line item inside an order, or one customer. Counting rows or summing amount only means what you think it means when you know the grain.
Rather than guessing from column names, check the grain in code by comparing the number of rows (len(rows)) with the number of distinct values in the identifier column (order_id). In Python, a set comprehension removes duplicates, so len({r["order_id"] for r in rows}) counts the unique order_id values across the file. If set comprehensions look unfamiliar, ask your Maestro to walk through how that one-liner works.
Try it
In the workbench below, open data/README.md to read the export note for September's file, then run explore.py. Add code to print the number of distinct order_id values and the sorted list of regions (sorted({r["region"] for r in rows})), and finish by writing your provenance and grain notes as comments at the end of explore.py.
A good place to stop. Up next: the workbench · 8 min · on a computer
A good place to stop. Up next: What the README and your script show · 2 min
What the README and your script show
Once your script runs and you have read data/README.md, you have a complete record of what data/sales_2026-09.csv actually holds:
- Source and export time: The file came from the shop's order system, exported by the operations team's
monthly_ordersjob on 2026-10-01 at 06:00 (one file per calendar month). - Exclusions: Orders cancelled before the export ran are left out. That cutoff matters for the report: the file counts orders still standing at export time on the 1st, whereas an order cancelled after the export ran would still appear in the file.
- Units: Every value in
amountis in US dollars, after discounts and before tax. - Grain: The table has 8 rows and 8 distinct
order_idvalues across four regions ("East", "North", "South", and "West"). Because every row has its ownorder_idand there is no customer column, one row represents one order.
If your output did not match or you want feedback on the comments you wrote in explore.py, share them with your Maestro.