Data Science Prompting Principles
Reviewed by Human · Updated October 14, 2026
Every data scientist's reflex with a new AI tool is the same: paste a CSV, type *analyze this*, hit enter. Seconds later the model hands back confident trends and correlations — most of which it invented. The tool didn't fail you. You just handed a language model a job meant for a calculator.
✗ Wrong way
Here's my sales_data.csv attached. Analyze this dataset and tell me the top three trends, any strong correlations, and which region is underperforming this quarter.
The model can't open the file, hold 50,000 rows in memory, or run a single calculation. So it does the only thing it can: generate text that *looks* like a plausible analysis. The 'correlations' and 'underperforming region' are pattern-matched fiction, not measurements — and they're specific enough to sound trustworthy.
✓ Better way
I have a sales dataset in a pandas DataFrame (columns: date, region, product, units, revenue; ~50k rows). Write the pandas code to (1) compute monthly revenue by region and (2) flag the region with the steepest three-month decline. Add a comment on each step explaining what it checks so I can verify the logic before I run it.
You describe the structure, name the tool, and ask for code *you* execute. The model does what it's actually good at — reasoning about method — and your machine produces the numbers. Nothing gets invented.
If it can't crunch the numbers, what is an AI actually for in data work?
What Can AI Actually Do With Your Data?
The fastest way to stop getting hallucinated numbers is to sort every data task into two buckets: reasoning (great) and computation (dangerous). **Reasoning engine**: a system that manipulates language and logic patterns, not numbers stored in memory. **Hallucination**: a confident, well-formed answer that has no basis in real data or computation. What it does well: - Writes analysis code in Python or R from a described dataset - Picks an appropriate method or test and explains the tradeoffs when you reason step by step with it - Interprets real output *after you paste it back* - Rewrites one finding for analysts, PMs, and executives What it must not do: - Report a number it could not have computed - 'Read' a file it was never actually given - Promise arithmetic is correct without you running it Every good data prompt starts from this split, and the context you provide is what keeps the model on the reasoning side of the line.
Field note
The first time this bit me, I asked a model to 'summarize' a churn export and it told me retention had fallen 14% quarter-over-quarter. The figure was precise enough that I nearly dropped it into a leadership deck — until I remembered I'd never actually given it the data. It had manufactured a believable number from thin air. Since then I have one unbreakable rule: the model writes the query, I run it, and the number does not exist until my machine prints it.
Your turn
Below is a lazy, hallucination-inviting prompt. Rewrite it so the AI reasons about method and hands you verifiable code instead of invented numbers.
Reflect
Did your rewrite make it impossible for the model to report a fake number? If it could still slip one in, tighten it.
You paste a DataFrame description and ask the AI, 'What's the exact mean revenue per region?' It replies with specific dollar figures. What's the right read?
Go deeper
You've finished this module.
Mark it complete to earn your XP and keep your streak alive.
Progress saved locally · Sign up to earn XP