Lesson 5 of 9 · about 16 minutes
Analyzing Data with AI, and Checking the Math Yourself
You'll be able to
- Know the difference between an AI that does math in its head and one that runs code
- Understand why an analysis that shows its method can be checked and one that hides it cannot
- Catch common data errors: wrong denominators, duplicated rows, mixed units, percent versus percentage points
- Recompute a key figure by hand before you repeat it
- Judge whether an AI-drafted chart tells the truth
Ask a chat assistant to add 47 numbers in its reply and it may well get the answer right. It may also drop a digit, because a language model writing a sum is predicting what a sum looks like. Ask the same tool to load your spreadsheet and run code, and the arithmetic becomes exact. The code can still add the wrong column. So data work with AI holds up only when the machine computes, shows the method, and a person checks the result.
Tools that run code
As of October 2026, the major assistants can analyze uploaded spreadsheets by writing and running code. OpenAI's help center says ChatGPT writes and runs Python in a notebook environment, accepts .xls, .xlsx and .csv files among others, cannot reach the web from inside that environment, and recommends that users review the generated code, outputs and assumptions. Claude accepts CSV and XLSX uploads up to 500 MB per file in chat and 30 MB in projects (XLSX requires the code execution and file creation setting to be on). Google announced in July 2026 that Gemini Notebook would get code execution for data analysis, rolling out by plan. Limits change; each vendor's help page lists the current ones for each plan.
The visible code is the point. When the tool shows you the steps, you can see which column it summed, which rows it filtered out, and whether it divided by the right thing. People who don't read code can ask the tool to explain each step in plain words, numbered. The check is on the recipe, since the cooking is exact.
What a show-your-work request looks like
[complaints_2025.csv attached]
This file lists code-enforcement complaints for the invented city
of Fenwick in 2025. Before analyzing:
1. Tell me the number of rows, the column names, and the date range.
2. Count exact duplicate rows and rows with the same address and
date. Do not remove anything yet; report the counts.
Then, after I confirm:
3. Count complaints by neighborhood, with duplicates removed.
4. Using the household counts I'll paste below, give complaints per
1,000 households.
Show each step's code and explain it in one sentence. Give final
numbers in a table I can copy.
Splitting the job shows the raw data's shape before any conclusions. If the row count doesn't match what the city said it released, that mismatch matters more than any result that follows.
Worked example: counts versus rates
Fenwick (invented) released 1,412 complaints. The AI found 37 exact duplicates and 61 same-address, same-day pairs that looked like one complaint entered twice. Lena Arvo, a neighborhood association volunteer, called the code office, which confirmed that its system logs a phone complaint and its follow-up as separate rows. After removing the 37 exact duplicates and the 61 double entries, 1,314 remained (1,412 minus 37 minus 61).
| Neighborhood | Complaints | Households | Per 1,000 households |
|---|---|---|---|
| Northgate | 508 | 6,350 | 80.0 |
| Riverside | 372 | 2,480 | 150.0 |
| Old Town | 291 | 3,880 | 75.0 |
| Hillcrest | 143 | 2,860 | 50.0 |
| Total | 1,314 | 15,570 | 84.4 |
Lena's hand check: 508 + 372 + 291 + 143 = 1,314. Good. Riverside: 372 divided by 2,480 = 0.15, times 1,000 = 150. Northgate: 508 divided by 6,350 = 0.08, times 1,000 = 80. Citywide: 1,314 divided by 15,570 = 0.0844, or 84.4 per 1,000.
Northgate has the most complaints. Riverside has nearly twice the rate. Those are two different findings, and only the second one says something about the neighborhood instead of its size. The AI's first summary opened with "Northgate tops the complaint list," which was true and mostly useless.
Then she asked one more question no spreadsheet could answer: who files the complaints? The code office said one Riverside landlord dispute produced about 90 complaints from two callers. That's 90 of Riverside's 372, almost a quarter. Data analysis gets you to the question. A phone call answers it.
The errors to hunt
| Error | Example | Check |
|---|---|---|
| Wrong denominator | Total crimes instead of crimes per resident | "Per what?" for every comparison |
| Percent vs. percentage points | 3.2 to 4.0 percent called "up 0.8 percent" | It's 0.8 points, or a 25 percent relative rise |
| Mixed units | One year's file in dollars, next year's in thousands | Compare totals with the printed document |
| Duplicates | Same complaint logged twice | Duplicate counts before analysis |
| Small numbers | Five home sales, one ranch at $2.4 million | The count and the median |
| Inflation ignored | Comparing 2016 and 2026 dollars directly | "Not adjusted for inflation," or an adjustment with CPI |
| Wrong time window | Fiscal year compared with calendar year | Check the date range in step 1 |
Percent versus points, worked
The county's unemployment rate went from 3.2 percent to 4.0 percent.
Point change: 4.0 minus 3.2 = 0.8 percentage points.
Relative change: 0.8 divided by 3.2 = 0.25, so the rate rose 25 percent.
Both are true. "Up 0.8 percent" is wrong. "Up 25 percent" is accurate but can alarm without the points beside it. The clearest version, at a meeting or online: "rose from 3.2 percent to 4.0 percent."
Charts
AI tools draft charts quickly. A chart deserves the same hard reading as text, whether it comes from an AI or from an agency slide deck.
- Bars start at zero. A bar chart with an axis starting at $3 million makes a 5 percent difference look like a tripling.
- Labels and source line. Every chart says what's measured, the unit, the years and where the data came from.
- Rates for unequal groups. Neighborhoods of different sizes get per-household bars, not raw counts.
- One message. A chart whose point can't be said in one sentence shows too much.
- Re-plot one point. One bar's height checked against the table catches a mislabeled chart.
Common mix-ups
- Claim: If the AI ran code, the answer is right. What the evidence shows: Code computes exactly what it was told to. OpenAI's own help page tells users to review the code, outputs and assumptions. Wrong column, wrong filter, wrong join: exact and wrong.
- Claim: Bigger count means bigger problem. What the evidence shows: Counts track size. Rates track risk. Both matter, and the one that answers the question at hand goes first.
- Claim: The AI cleaned the data, so it's clean. What the evidence shows: Cleaning means decisions, such as what counts as a duplicate. Those decisions need a human who called the agency.
Reporting angle
When you request data, ask for the record layout or data dictionary that explains each column, plus any codes. Ask how duplicates and follow-ups are logged. Ask for the same data for prior years in the same format so comparisons are fair. If the agency publishes a summary number, request the underlying rows and see whether you can reproduce it.
Research angle
- OpenAI Help: Data analysis with ChatGPT: what file analysis can and cannot do.
- Google: Gemini Notebook announcement: the July 2026 rename and what the notebook does with your sources.
- Claude Help: Uploading files: file types and size limits.
- Idaho FOIA / Public Records Letter Generator: drafts a request under Idaho Code Title 74, Chapter 1.
Check yourself
1. Why is it safer to have an AI tool run code on a spreadsheet than to ask it to add numbers in a chat reply?
Language models can make arithmetic slips in plain text. Code execution computes exactly, but the code can still use the wrong column or filter, so you read the method.
2. A county's unemployment rate went from 3.2 percent to 4.0 percent. Which description is accurate?
The difference between two percentages is in percentage points: 4.0 minus 3.2 is 0.8 points. The relative change is 0.8 divided by 3.2, which is 25 percent.
3. An AI analysis of 1,412 code-enforcement complaints says one neighborhood had 'the most complaints.' What is the first question to ask?
Raw counts favor big neighborhoods. A fair comparison needs a rate, and complaint logs often hold duplicates. The denominator and the cleaning decide whether the claim holds.
4. An AI-drafted bar chart of department budgets starts its vertical axis at $3 million instead of zero. What is the problem?
People judge bars by length. A truncated axis exaggerates differences. Bar charts start at zero.
5. The AI reports that the average home sale price in the invented town of Orrin rose 22 percent. Five sales were recorded; one was a $2.4 million ranch. What should you check?
Tiny samples and outliers wreck averages. The median and the number of sales tell the real picture, and five sales may not show a trend at all.
Terms in this lesson
- Code execution
- A feature where the AI writes and runs a program, often Python, to analyze an uploaded file instead of guessing in text.
- Denominator
- The number you divide by. Choosing the right one (per resident, per household, per year) decides whether a comparison is fair.
- Percentage point
- The plain difference between two percentages. 3 percent to 5 percent is a 2-point rise and a 67 percent increase.
- Median
- The middle value when numbers are sorted. Less affected by a few huge values than the average.
- Sanity check
- A quick test of whether a result is even plausible, such as comparing it with a known total or last year's figure.
Sources
- OpenAI Help Center: Data analysis with ChatGPT checked 2026-10
- Google: NotebookLM is now Gemini Notebook (code execution in notebooks) checked 2026-10
- Claude Help Center: Uploading files to Claude checked 2026-10