AI for data analysis
Prompt for charts and defensible insights
Ask AI to connect every chart and observation to a defined question, visible calculation, and honest limitation.
Before you start
Why this matters
Picture a dashboard with a rising blue line and the title “Customer engagement is accelerating.” What would you need to inspect before trusting that sentence? List the measure on the vertical axis, denominator, time interval, start date, end date, missing periods, and whether the axis begins at zero. A chart can be technically accurate while its title tells a stronger story than the data supports.
1Learn the idea
Read
Give the model an analysis brief
“Make interesting charts” rewards novelty, not relevance. A better prompt carries forward the question contract and data dictionary. Tell the model:
- the decision and primary question;
- what one row represents;
- the exact measure and denominator;
- filters and exclusions;
- comparison groups and date windows;
- available columns and their units;
- chart audience and medium;
- claims it must not make;
- required calculation table or code.
For example:
Question: Did median resolution time improve after the support change?
One row is one resolved ticket. Compare the eight complete weeks before
with the eight complete weeks after. Exclude test tickets, but report
their count. Break down by priority because the mix may have changed.
Return:
1. a weekly calculation table with ticket count and median minutes;
2. one chart recommendation with title, axes, and annotation;
3. three observations tied to exact values;
4. data-quality concerns and alternative explanations.
Do not claim the support change caused any difference.
This structure asks AI to expose the evidence behind its prose.
Read
Match the chart to the question
Choose charts by analytical task, not decoration:
- Change over time: line chart with regular intervals and clearly marked gaps.
- Compare categories: sorted bar chart with a shared baseline.
- Show a distribution: histogram, box plot, or dot plot rather than an average alone.
- Show a relationship: scatter plot, ideally with sample size and sensible scales.
- Show composition: stacked bars when there are few categories and totals matter.
- Show a process: funnel only when stages form a consistent sequence.
Pie charts become hard to compare with many slices. Dual-axis charts can suggest relationships because two scales can be tuned to move together. Three-dimensional effects distort area and angle. AI may suggest these familiar formats unless you set constraints.
Ask for two candidate chart types and the tradeoff of each. The final choice remains an analytical decision.
Read
Make denominators visible
Counts and rates answer different questions. If complaint count rises from 100 to 130 while orders double from 1,000 to 2,000, complaints increased but the complaint rate fell from 10% to 6.5%. Neither statement is sufficient alone.
For a rate, request numerator, denominator, and eligibility rule. “Conversion by channel” should define:
- what counts as a conversion;
- which sessions are eligible;
- whether one user can convert more than once;
- attribution window;
- treatment of missing channel;
- minimum group size.
Include counts beside percentages. A 50% conversion rate from two sessions should not visually compete with a 20% rate from 20,000 sessions without context.
Read
Prompt for observations, not stories
An observation reports a supported pattern: “Median resolution time fell from 14.2 to 11.8 hours.” An interpretation suggests meaning: “The new routing process may have contributed.” A recommendation proposes action: “Continue the process while monitoring urgent tickets.”
Ask the model to label these separately. Require each observation to cite the rows, groups, or values used. Require interpretations to list alternative explanations. Require recommendations to name uncertainty and a way to test the next step.
A useful evidence template is:
- Observation: exact direction, size, period, and group.
- Support: calculation and sample size.
- Caveat: missingness, composition change, or comparison limit.
- Possible explanation: explicitly not established as cause.
- Next check: additional slice, source, or experiment.
This prevents AI from turning every fluctuation into a narrative.
Read
Ask for uncertainty and stability
Point estimates look more certain than they are. For samples, request confidence intervals or another method suited to the measure and design. For operational totals, uncertainty may come less from sampling and more from missing data, changing definitions, delayed records, or measurement error.
Ask whether the pattern survives reasonable alternatives:
- mean versus median;
- including versus excluding incomplete periods;
- raw totals versus per-user rates;
- current category mapping versus original values;
- different but defensible date windows;
- all groups versus groups above a minimum sample.
This is a sensitivity check. A finding that reverses under a small, reasonable choice should be presented as fragile.
Read
Control scales, labels, and annotations
Specify units on every axis. Use a zero baseline for bars unless a different baseline is clearly justified and disclosed. For lines, a truncated axis may reveal small variation, but the range must not exaggerate practical importance. Keep time intervals uniform and sort categorical bars deliberately.
Titles should state what the chart shows, not what you hope it proves. “Weekly refund rate, January–June” is neutral. “Refund problem finally solved” assumes a conclusion and cause. An annotation may note a policy launch, but temporal proximity does not establish impact.
Request accessible output: high contrast, labels that do not rely on color alone, concise alternative text, and readable values. If the chart will appear in a slide, ask how it survives projection and a small screen.
Read
Inspect generated code
If AI generates Python, SQL, or spreadsheet formulas, review the filters, grouping, aggregation, joins, sort order, date boundaries, and null handling. Run the calculation table before the chart. A beautiful chart can faithfully display a wrong query.
Save the prompt, code, package versions when relevant, and output data. Reproducibility means another analyst can regenerate the picture—not merely take a screenshot of it.
Continue learning · glossary & guides
- Which chart matches a distribution rather than a trend?
- Can you identify the numerator and denominator behind each rate?
- What separates an observation from an interpretation?
- Which sensitivity check could reverse your current finding?
- How-to: analyze CSV with AI · Glossary: prompt engineering