By the end of this lesson you will have a cleaned sales file, a cleaning log that shows rows before and after every step, and a saved list of every row you removed.
You need: your workbench from lesson 1 with your anonymised sales file or practice_sales.csv, and Excel or Google Sheets to check · Time: 8 minutes
Our example is
sales_q2.csv: 4,812 invoices from July to September 2026 for a lighting distributor in Ahmedabad. Yours may be the practice file; the steps are the same.Before any cleaning, give the AI the rules for the whole session. Two ideas matter most:
- Raw stays raw. The original file is never changed. Cleaned data goes to a new file. With an agent, keep the original in a
rawfolder inside the project; in Colab, the original is the copy on your laptop. - A cleaning log. A small table where every step writes one line: what changed, rows before, rows after, and proof. At the end it tells you, and your manager, exactly what happened to the data.
Prompt · copy it into your AI agentWe are going to clean [sales_q2.csv] step by step. Rules for this whole session: 1. Never change or overwrite [sales_q2.csv]. Write the cleaned data to sales_clean.csv. 2. Do one step at a time, and wait for my OK before the next step. 3. After every step, print: step number, what changed, rows before, rows after, number of cells changed, and 3 example rows before and after. 4. Add the same line to cleaning_log.csv (columns: step, what_changed, rows_before, rows_after, cells_changed, note). 5. Never drop a row without saving the dropped rows to a file and telling me the file name. 6. Never guess a value. If you cannot convert or map something, list it and ask me. Start by confirming the row count of the raw file. Do not clean anything yet.
One line per step. Rows only go down where you decided they should. Why?Without a log, a cleaned file is a black box. With one, anyone can see that 37 rows were removed, why, and where they are, and you can undo any step.
- Raw stays raw. The original file is never changed. Cleaned data goes to a new file. With an agent, keep the original in a
Log in free to read the rest of this lesson
Every lesson is free. A free account unlocks all of them and saves your progress.
Still to come in this lesson:
- Amounts: "Rs 1,24,500" is text, not a number
- Dates: tell it the format, never let it guess
- State names: a mapping table you approve
- Duplicates: a person decides the rule
- Recap