Most data scientists use ChatGPT like a fancy Stack Overflow: paste an error, get a fix, move on. That leaves the real leverage on the table. An LLM is strongest not at writing a single line of pandas, but at being a second pair of eyes on your data — one that never gets tired of checking dtypes, never assumes the join key is unique, and will happily rewrite a feature-engineering block five times until the leakage is gone.
Below are 12 prompts I actually run in day-to-day work. Each comes with a real usage example and the code or context you feed the model. They are ordered along the pipeline: EDA, cleaning, feature engineering, modeling, visualization. Copy them, adapt them, but keep the structure — the structure is what makes them work.
1. The data contract prompt: make the model audit your schema first
Before any analysis, you need the model to understand what each column means, not just its dtype. This prompt asks it to build a data dictionary with ranges, null rates, and business meaning — then flag contradictions.
Prompt:
You are a senior data analyst. Below is a pandas DataFrame summary
(dtypes, null counts, nunique, min/max, 3 sample values per column).
Build a data dictionary with: column, dtype, business meaning (infer
or mark UNKNOWN), null rate, value range, and suspicious flags.
Flag: (1) columns that look like IDs but have nulls, (2) numeric
columns with impossible values (negative age, future dates),
(3) constant or near-constant columns. Do not write code yet.
Usage example. Feed df.describe(include='all').T plus df.isna().mean(). On a churn dataset the model immediately flags last_login containing dates in 2031 — a classic timezone or epoch-seconds bug that survives describe() because the dtype is still datetime.
2. EDA prompt: find the story, not the summary
df.describe() is not EDA. EDA is looking for why a distribution is bimodal. This prompt makes the model propose hypotheses and the exact code to test each one.
Prompt:
I have a tabular dataset for a [regression/classification] task.
Target: [name]. Features: [list]. For each feature, propose the
single most informative plot and one statistical check. Then list
the top 5 hypotheses about data quality or relationships that
would change my modeling approach if true, with the exact pandas
code to test each. Prioritize hypotheses that are cheap to test.
Usage example. For a loan-default dataset the model suggests checking whether income == 0 correlates with default == 1 — often a data-entry placeholder, not a real income. One df.groupby('income_zero')['default'].mean() later, you find a 40% default rate in that bucket. That is not a feature; that is a data quality issue.
3. Cleaning prompt: write assertions, not just fillna
Anyone can call fillna(0). The hard part is knowing which fill is safe. This prompt forces the model to justify each imputation and write a test that would catch a regression.
Prompt:
For each column with nulls, recommend: drop, mean/median/mode fill,
model-based fill, or leave-null-with-flag. Justify in one sentence
based on the null mechanism (MCAR/MAR/MNAR if inferable). Then
write pytest assertions that verify: no nulls remain where required,
no negative values in [columns], and row count change is < X%.
Return a cleaning function plus the test file.
Usage example. On a marketing dataset, campaign_spend is null whenever channel == 'organic' — that is MNAR by design, not a bug. Filling with 0 is correct; filling with the mean would invent spend that never happened. The model catches this if you give it the groupby('channel').isna().mean() output.
4. Feature engineering prompt: generate candidates, then prune
This is where the keyword of this article earns its keep. The model is excellent at brainstorming feature engineering ideas; it is terrible at knowing which ones leak. So split the job: brainstorm first, audit second.
Prompt:
Target: [name]. Task: [task]. Here are the columns and their meanings:
[data dictionary]. Propose 15 candidate features grouped by type:
(1) arithmetic ratios, (2) time-based (recency, frequency, trend),
(3) aggregations over [entity], (4) interactions. For each, give
the pandas expression and one sentence on why it might help.
Then mark each as SAFE or LEAKY if it uses information from after
the prediction moment. Prediction moment: [describe].
Usage example. For a subscription-churn model with prediction moment = end of billing month, the model proposes days_since_last_login, support_tickets_last_30d, plan_price / tenure_months. It also flags cancellation_reason as LEAKY — obviously recorded only after churn. That flag alone saves you from a model with 0.99 AUC that fails in production.
5. The time-series feature prompt
Time features break more models than any other type. This prompt makes the model think in terms of the forecast origin.
Prompt:
I have a time series with columns [timestamp, value, covariates].
Forecast horizon: [H]. Write feature engineering that is valid
for a rolling-origin setup: lags (which lags and why), rolling
stats (window, min_periods), calendar features, and holiday flags.
For each feature, state the minimum history required and confirm
it does not use future values. Show the code with .shift() applied
correctly.
Usage example. A common bug: df['value'].rolling(7).mean() without .shift(1) leaks the current day into its own prediction. The model's output explicitly includes shift(1) before rolling, and a comment explaining why. That comment is the difference between a working model and a mysteriously perfect one.
6. Modeling prompt: baseline before complexity
The temptation is to jump to XGBoost. This prompt forces a baseline and a reason to beat it.
Prompt:
Task: [task]. Data: [shape, target distribution]. Metric: [metric]
and why it fits the business cost of errors. First, specify the
simplest baseline (majority class / median / linear model) and its
expected score. Then propose 3 models of increasing complexity with
the trade-off (accuracy vs interpretability vs training time).
For each, list the 2 hyperparameters that matter most and a
sensible search range. Do not write training code yet.
Usage example. On an imbalanced fraud dataset (1.2% positives), the model recommends PR-AUC over ROC-AUC and a DummyClassifier baseline. If your fancy model's PR-AUC is 0.31 and the baseline is 0.012, you have real lift; if you only looked at accuracy, both look "99% accurate" and you learn nothing.
7. The validation-split prompt that prevents optimism
Cross-validation is easy to get wrong when rows are grouped or time-ordered. This prompt makes the model pick the right splitter and justify it.
Prompt:
Data: [describe rows, groups, time]. Model will be used to predict
[what] for [whom] at [when]. Recommend the validation scheme:
KFold, StratifiedKFold, GroupKFold, TimeSeriesSplit, or a custom
scheme. Explain what would go wrong with the naive KFold here.
Then write the sklearn code, including any preprocessing that must
live inside the pipeline to avoid leakage.
Usage example. With multiple transactions per customer, naive KFold puts the same customer in train and validation — the model memorizes customers, not behavior. GroupKFold(groups=customer_id) fixes it. The prompt also reminds you to put StandardScaler inside the Pipeline so it fits only on training folds.
8. Visualization prompt: a chart with a message
A plot that does not change a decision is decoration. This prompt forces the chart to answer a question.
Prompt:
I need to show [audience] that [one-sentence message]. Data:
[columns]. Propose the single best chart type, the exact seaborn/
matplotlib code, axis labels, and a title that states the message,
not the variables. Then name one alternative chart and why it is
worse for this message.
Usage example. Message: "Churn is concentrated in the first 90 days." The model produces a survival-style line with a shaded 0–90 day band, title "Two-thirds of churn happens before day 90". The alternative — a bar chart of churn by tenure bucket — is rejected because it hides the time axis.
9. The "explain like a stakeholder" prompt
After modeling, you must translate coefficients or SHAP values into business language. This prompt does that without dumbing it down.
Prompt:
Here are the top 10 features by [SHAP/coefficient] with values:
[table]. Write a 150-word summary for a non-technical stakeholder.
For each feature, state direction of effect and a plausible
mechanism. Explicitly separate correlation from causation and
flag any feature that is a proxy for something unactionable.
Usage example. A feature app_version ranks high — but it is a proxy for device age, not a lever you can pull. The model flags it as "unactionable; do not build a campaign around it." That one sentence saves a meeting.
10. The reproducibility prompt
Notebooks rot. This prompt turns your messy session into a runnable script with seeds and pinned versions.
Prompt:
Convert the following notebook cells into a single runnable script:
[cells]. Requirements: fixed random seeds for numpy/random/sklearn,
a requirements.txt with pinned versions, a main() function,
and argparse for input/output paths. Flag any cell that depends
on execution order and would break when moved.
Usage example. The model catches that cell 7 uses a variable created in cell 3 inside an if block that only runs when a debug flag is on. In the notebook it works; in the script it throws NameError. Better to find that now than at 2 a.m. before a demo.
11. The code-review prompt for pandas
Pandas code is deceptively easy to write and hard to trust. This prompt reviews it like a colleague would.
Prompt:
Review this pandas code for: (1) chained assignment warnings,
(2) silent dtype coercion, (3) merges without validate=,
(4) groupby that drops NaN groups unexpectedly,
(5) any place where .copy() is missing before mutation.
For each issue, show the problematic line, the failure mode,
and the fix. Be concise.
Usage example. A df.merge(other, on='id') silently duplicates rows because other has duplicate IDs. Adding validate='one_to_one' turns a silent bug into a MergeError. The prompt suggests exactly that.
12. The "what would break this model" prompt
Before shipping, ask the model to attack your own work. This is the highest-value prompt in the list.
Prompt:
Here is my final model summary: [features, metric, validation
scheme, data period]. Act as a skeptical reviewer. List the 5 most
likely reasons this model will underperform in production.
For each, give a concrete monitoring check (metric, threshold,
alert) that would catch it early.
Usage example. The model predicts that feature drift in avg_order_value after a pricing change will degrade the model, and suggests a PSI (Population Stability Index) check with an alert at 0.2. It also flags that the validation period was a holiday season — a distribution the model overfits to.
Putting it together
The pattern across all 12 prompts is the same: make the model state assumptions and write the check before writing the code. That is what separates a useful analyst partner from a confident hallucinator. Start with prompt 1 and 12 — the audit and the attack — and you will already catch more bugs than a week of manual review.
If you want to go deeper into the data side — SQL, indexes, and query design that survives real load — the SQL & Databases is a solid next step. And if you are still building your analytics foundation, the Profession: Data Analyst path maps the full route from zero to job offer.