AI-Assisted Data Science Workflows
Using AI coding assistants to speed up analysis work without letting unverified output into your conclusions.
AI-Assisted Data Science Workflows
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- An AI assistant is fastest at boilerplate and syntax recall: loading data, reshaping frames, writing regex, and translating a plotting call from one library to another.
- A generated analysis step is a hypothesis about your data until you check it against a known value, a manual spot check, or a second method that should agree.
- The highest-risk failure mode is silent misinterpretation of your schema, such as assuming a column means something it doesn't, because the code still runs without error.
- Treating the assistant as a pair programmer who writes a first draft, rather than an authority who writes a final answer, keeps the speed gain without the correctness loss.
What actually gets faster
An AI coding assistant doesn’t make you a better analyst; it makes the mechanical parts of analysis cheaper. Loading a CSV with the right encoding, pivoting a dataframe, writing the regex that strips currency symbols from a column, remembering whether pandas.merge takes on or left_on and right_on, translating a matplotlib chart into seaborn because you want the styling — these are all things an assistant handles well, because the answer is public, well-documented, and not specific to your dataset. If you spend ten minutes per day looking up syntax you’ve looked up before, an assistant removes most of that ten minutes. That’s a real, compounding gain across a week of work, and it’s the main reason “vibe coding” for data science is worth taking seriously rather than dismissing as a fad.
What doesn’t get faster, or get safer, is the part of the job that requires knowing your data. An assistant has never seen your customer_id column drift from a unique key to a shared household ID after a schema migration three quarters ago. It doesn’t know that a retailer’s returns table only started populating in 2023 and that any trend you compute across the full history is really a step function. Those are the failure modes that matter, and they don’t show up as errors — they show up as numbers that look reasonable and are wrong.
A worked example of where it goes sideways
Say you ask an assistant to write code that computes average order value by month, using a dataframe with order_id, customer_id, amount, and created_at. It writes a clean groupby("month").amount.mean() after extracting month from created_at. The code runs, produces a tidy line chart, and the trend looks plausible — average order value creeping up over the year.
The catch: if amount includes refunds as negative rows, and refunds aren’t evenly distributed across months (say, more refunds happen in January after holiday returns), your “average order value” is actually “average order value net of refund timing,” which is a different metric with a different story. The assistant had no way to know this, because nothing in the column names or a sample of five rows reveals it. The only way to catch it is to already know your data well enough to ask “wait, does amount ever go negative here?” and to check. That check takes thirty seconds. Skipping it is how a wrong conclusion reaches a stakeholder.
Verification habits that scale
The fix isn’t to distrust every line an assistant writes — that defeats the purpose. It’s to build verification into the workflow at a few fixed points rather than relying on vigilance everywhere:
- Before you ask, give the assistant real schema information: column names, dtypes, and a few sample rows, including edge cases like nulls or negative values if you know they exist. A vague prompt gets a generic, un-contextualized answer.
- After you get code back, read it line by line once, even if you’d normally skim. The goal isn’t to catch syntax errors, which Python will catch for you; it’s to catch wrong assumptions, like a
dropna()silently removing 30% of your rows or a join that fans out duplicates. - After you run it, sanity-check the output against something independent: a round number you already know (total revenue, total row count), a manual calculation on a tiny slice, or a second approach that should land on the same answer. If a groupby and a pivot table disagree, something upstream is wrong.
- For anything going into a report, re-derive the final number a different way before you ship it. This is the single most valuable check you can make, because it’s the number someone else will act on.
Debugging is where assistants shine brightest
Debugging is a different workflow from writing new analysis, and it’s where AI assistance has the best risk-to-reward ratio. Pasting a traceback and the surrounding code into an assistant is low-risk: either it correctly identifies the bug (a type mismatch, an off-by-one in a date range, a missing .copy() causing a SettingWithCopyWarning), or it doesn’t and you’re no worse off than before. Unlike generating new analysis logic, debugging has a built-in check — the code either now runs correctly against your test case or it doesn’t — so the “runs without error but wrong” failure mode is much rarer here. This makes debugging a good place to lean on an assistant more heavily than you would for first-draft analysis logic.
Boilerplate versus judgment, as a rule of thumb
A useful mental split: anything you could verify by reading documentation is safe to delegate heavily — library syntax, standard transformations, common chart types, writing test fixtures. Anything that requires knowing facts about your specific dataset, your business logic, or your stakeholders’ definitions of a metric needs your judgment applied before and after, no matter how confident the generated code looks. The assistant can write the groupby; only you know whether grouping by created_at or by order_date is the one your stakeholders actually mean by “month,” and whether that distinction changes the story on the chart.
Check yourself
Why is generated analysis code more dangerous when it runs without errors than when it crashes?
A crash forces you to look at the code, but code that runs cleanly and produces a plausible-looking number invites you to trust it, even when a wrong assumption about the data silently produced that number.
What is a concrete way to verify a generated aggregation step before using its output in a conclusion?
Check it against something you already know: a manual calculation on a small slice, a known total like a row count, or a second method such as a groupby versus a pivot table that should produce the same number.
What kind of task is an AI assistant least reliable for in a data science workflow, and why?
Judgment calls specific to your data, such as whether an outlier is a sensor error or a real event, because the assistant has no access to your domain context and will confidently guess rather than flag its uncertainty.
Go deeper
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.