Analyzing data with AI

Upload a spreadsheet, ask questions, check the code. About 1 h, intermediate level.

You'll be able to

What happens when you upload a spreadsheet

When you give ChatGPT, Claude, Gemini or Julius a CSV or Excel file and ask a question, the assistant usually doesn't “look” at the numbers the way you would. It writes code, typically Python, runs it on your file in a sandbox, and then describes the output in plain English, often with a chart. Copilot in Excel works on the open workbook in a similar spirit.

That has one big consequence: the code is the analysis. The friendly paragraph is a description of what the code did, written by the same model, and it can gloss over choices the code made. Julius and most assistants will show the code if you ask; some show it by default.

You don't need to be a programmer to benefit, but you do need to stay the analyst. The AI is fast at the mechanics. You decide which questions matter, which assumptions are acceptable and whether the answer makes sense.

Describe before you analyze

Before asking any real question, ask the assistant to describe the dataset: “How many rows and columns? What type is each column? How many values are missing per column? Any duplicates, odd values or inconsistent formats?”

Then compare the answer with what you know. Does the row count match the source? Are the columns what the documentation says?

Common problems this step catches:

Fixing these first prevents confident answers built on a misread file.

Check the code and its assumptions

Every analysis involves choices, and an assistant makes them silently unless you ask. Watch for these:

Ask directly: “List every decision you made about missing values, filters, outliers and grouping.” Then ask for the code, and for a line-by-line explanation of any part you don't follow.

A useful cross-check is to ask for the same result computed a different way, such as a pivot table instead of code. If the answers differ, find out why before you use either.

Verify one number, and question the story

Pick one figure the answer depends on and reproduce it yourself: filter the spreadsheet, sum a column, or build a quick pivot table. If your number matches, you've confirmed the file was read correctly and the calculation does what it claims. If it doesn't, you've found a problem before anyone else did.

Then question the interpretation:

The assistant can help here too: ask “What are three reasons this pattern might not mean what it seems?”

Keep data where it's allowed to be

The easiest analysis mistake to make, and the hardest to undo, is uploading data you weren't allowed to share.

Use USC's ChatGPT Edu workspace for university work rather than a personal account, but a university workspace doesn't override an IRB protocol or data agreement. Removing names isn't always enough to de-identify data: combinations of details such as zip code, birth date and gender can identify people. When unsure, ask your IRB, supervisor or data steward first.

A ten-minute data story, checked

Data: a city's open-data CSV of service requests (potholes, graffiti, streetlights), with open and closed dates and a neighborhood column.

Describe: the assistant reports the rows and columns, notes that “closed date” is blank for many rows, and that one neighborhood appears under two spellings. You ask it to merge the spellings.

Question: “Which neighborhood waits longest for a pothole repair?” It returns a bar chart of average days to close.

Check the code: it calculated days only for closed requests, silently dropping open ones. Neighborhoods with a backlog of old open requests look faster than they are. You ask for the median, and for the share of requests still open, per neighborhood.

Verify by hand: you filter the spreadsheet to one neighborhood's closed pothole requests and compute the median yourself. It matches.

Story: a chart of median days to close plus the share still open, with a note on what the data can't show, such as how requests were prioritized.

Try it

A short data story from a public dataset: the question you chose, one chart, the code or steps the assistant used, and a note showing one figure you verified by hand.