pickuma.
AI Knowledge Work

Using AI Coding Agents for Data Analysis Workflows

AI coding agents like OpenCode can write scripts, clean data, and generate visualizations for analysts. Here is where they help and where they still need human judgment.

6 min read

Analysts spend a surprising amount of time on plumbing: reading CSVs, fixing column names, joining tables, and formatting charts. The actual thinking, pattern recognition, and recommendation come only after the data is clean. AI coding agents can take over much of that plumbing if you give them the right instructions.

We tested OpenCode on a typical analyst workflow: take a raw export from a product analytics tool, clean it, join it with a customer CSV, and produce a summary chart. The agent handled the mechanical parts well and flagged a few edge cases we would have missed.

What the Agent Does Well

Three tasks were consistently fast and accurate:

  • Data cleaning. Renaming columns, dropping nulls, casting types, and standardizing date formats. The agent wrote pandas or polars code that ran on the first try.
  • Transformations. Merging datasets, grouping, aggregations, and window calculations. As long as the schema was clear, the generated code matched the intent.
  • Visualization boilerplate. Generating matplotlib, seaborn, or Plotly charts with sensible defaults. The styling needed tweaking, but the structure was right.

The Human Role in the Loop

The agent is good at syntax and structure. It is not good at deciding what the data means. An analyst still needs to:

  • Define the question the analysis is supposed to answer
  • Check that the join keys make business sense
  • Verify that aggregations do not double-count or drop important rows
  • Interpret whether a pattern is meaningful or a data artifact

We saw the agent produce a chart that looked correct but hid a subtle issue: it averaged a rate without weighting by denominator. The code ran, the chart rendered, and the conclusion would have been wrong. A human check on the calculation caught it.

OpenCode

Use OpenCode to generate data cleaning, transformation, and visualization scripts in Python or SQL. A good fit for analysts who want to automate the repetitive parts of their workflow.

Free tier available

Try OpenCode

Affiliate link · We earn a commission at no cost to you.

Practical Setup

OpenCode works well for this use case because you can keep the data local. Point it at a directory with your CSVs and a Python virtual environment, and ask for scripts rather than one-off notebook cells. The result is reusable code, not a throwaway notebook.

A typical prompt: “Write a Python script that reads events.csv and customers.csv, joins on customer_id, and produces a monthly active users chart saved to output/mau.png. Handle missing customer_id values by dropping those rows.”

The agent returns a script, not just a code block. You can run it, inspect the output, and iterate.

When to Use It and When to Skip It

Use an AI coding agent for data work when:

  • The task is repetitive and well-defined
  • The output is a script you can review and rerun
  • The stakes of a mistake are low to moderate

Skip it when:

  • The analysis informs a major business decision
  • The data is sensitive and cannot be sent to a cloud provider
  • The calculation requires domain-specific statistical knowledge

FAQ

Can OpenCode replace Python or SQL skills?
No. It helps you write code faster, but you still need to understand what the code does and verify the results. Think of it as an autocomplete for analysis scripts, not a replacement for analytical judgment.
Which data formats work best?
CSV, Parquet, and JSON are the most reliable. Excel files sometimes work if the agent uses the right library, but you may need to specify `openpyxl` or `pandas` explicitly.
Is the generated code reusable?
Yes, if you ask for a script instead of a code snippet. The agent can write a `.py` file that you run from the command line, making it easy to rerun when the data updates.

Tools used in this review

Some links above are affiliate links. We may earn a commission if you sign up. See our disclosure for details.

Related reading

See all AI Knowledge Work articles →

Get the best tools, weekly

One email every Friday. No spam, unsubscribe anytime.