Analysing with an AI assistant
An AI assistant can read your export, write the pandas code and draw the chart in two minutes. It can also join two files wrongly, average the wrong thing and write a confident paragraph about it. This lesson shows you how to brief an assistant, read what it did, and check its answer before anyone acts on it.
By the end you can
- Explain what an assistant that writes and runs code does well, and where its mistakes come from
- Write a prompt with the context a colleague would need: question, data dictionary, definitions, sample rows and rules
- Ask for the code and the steps, and spot joins, filters and averages in them
- Verify an answer with row counts, one number you recompute yourself and a short checklist
- Keep customer personal data out of tools your company has not approved
The everyday picture
Imagine a new intern who types faster than anyone in the office, knows every spreadsheet formula and never gets tired. On the first morning you hand over a file and say "find out why East city sales are down". Twenty minutes later there is a neat chart and a confident paragraph.
The intern has never visited a store. Nobody said that the earlier weeks included a festival, that two stores appear twice in the store list after a refit, or that "basket" means total sales divided by total transactions. The intern also never says "I'm not sure". Every answer sounds equally certain, right or wrong.
You would not forward that first paragraph to the head of stores. You would give a better brief, ask to see the workings, and check two or three numbers yourself. Working with an AI assistant is the same job.
What the assistant does when you upload a file
Two kinds of assistant matter for analysis. Chat assistants with a code tool (several, including ChatGPT, Claude and Gemini, can do this depending on the version and settings) take a file you upload, write Python, usually with pandas, run it on a separate temporary computer called a sandbox, read the output and write a summary. Assistants built into spreadsheets, such as Copilot in Excel or Gemini in Google Sheets, work on the sheet you have open: they suggest formulas, build summaries and describe a selected range.
Both are built on a large language model. The model writes text, and code is text. That gives you the most useful fact in this lesson. When the assistant runs code, the numbers in the output are computed by that code on your file, so they are exactly as right as the code. The sentences around them are written by the model, and they can say more than the output shows. If the assistant answers without running code, a number in the reply may not have been computed at all.
Assistants are good at the mechanical parts. They read a file's columns in seconds, write pandas or formulas quickly, try ten cuts of the data while you would try two, explain an error message, and draft a chart. For a beginner, reading the code they write is also a fast way to learn the pandas from the same analysis in Python.
Their mistakes come from three places. First, missing context: the file does not say that the earlier weeks held a festival, or which stores were refitted. Second, silent choices in the code: which key to join on, whether to drop blank rows, whether to take a mean of means. The assistant makes each choice without asking unless you tell it to ask. Third, words beyond the evidence: a summary that says "across all stores" when the code never split the data by store, or a column name the model hallucinated because a file like yours usually has one.
Quick check
The assistant's code printed one table, total fresh sales by week for the whole of East city. Its summary says "fresh sales fell in every East city store". How much of that sentence did the code show?
The output is computed, the sentence is written. A city total can fall because of a few stores or because of all of them, and the table cannot tell you which. Ask for the split by store, or make it yourself.