データ分析のためのコーディングエージェント
Simon Willison氏がNICAR 2026ワークショップで、Claude CodeやOpenAI Codexなどのコーディングエージェントをデータ分析に活用する方法をデータジャーナリスト向けに実践的に紹介した。
キーポイント
ワークショップの目的と構成
データジャーナリスト向けに、Claude CodeやOpenAI Codexなどのコーディングエージェントを使ってデータの探索・分析・クレンジングを行う3時間のワークショップを実施した。
実践的な技術スタック
ワークショップではGitHub CodespacesとOpenAI Codexを使用し、Python、SQLite、Datasetteを組み合わせた実践的な演習を行った。
具体的な応用例の実演
データベースへの質問、データ探索、データクレンジング、可視化作成、スクレイピングなど、多様なデータ分析タスクをエージェントで実行する方法を実演した。
可視化の実践例
Datasetteで静的コンテンツを提供し、Claude CodeにLeafletとLeaflet.heatを使ったインタラクティブなヒートマップの作成を自動生成させた実例を紹介した。
影響分析・編集コメントを表示
影響分析
この記事は、AIコーディングエージェントの実務応用における具体的なケーススタディを提供しており、データジャーナリズム分野での生産性向上の可能性を示している。技術的な実装詳細とコスト面の現実的な情報($23のAPI使用料)を含むことで、実用性の評価に役立つ内容となっている。
編集コメント
AIコーディングツールの実践的な応用例として、具体的な技術スタックとワークフローが詳細に記述されており、現場での導入検討に役立つ内容。コスト面の具体的な数字も実用性の判断材料として価値がある。
これは、NICAR 2026 ワークショップ「データ分析のためのコーディングエージェント」のために私が用意した配布資料です。Claude Code や OpenAI Codex といったツールを用いてデータを探索・分析・クリーニングする方法を、データジャーナリストを対象に3時間かけて紹介するセッションの内容です。
目次は以下の通りです:
- コーディングエージェント
- ウォームアップ:ChatGPT と Claude
- Claude Code と Codex のセットアップ
- データベースへの質問
- エージェントによるデータ探索
- データクリーニング:近隣コードのデコーディング
- エージェントによる可視化の作成
- エージェントによるデータスクレイピング
私はこのワークショップを GitHub Codespaces と OpenAI Codex を使用して実施しました。これは、参加者が授業中に使用できる予算制限付きの API キーを配布するのが容易(かつ安価)だったためです。参加者たちは合計で 23 ドル分の Codex トークンを消費しました。
すべての演習は Python と SQLite を使用し、一部では Datasette も利用されました。
ワークショップのハイライトの一つは、Datasette を実行して viz フォルダから静的コンテンツを配信し、その後 Claude Code にそのフォルダ内で直接新しいインタラクティブな可視化を「バイブコーディング」させることでした。以下は、Leaflet と Leaflet.heat を使用して私のツリーデータベースのために作成されたヒートマップです。ソースコードはこちら。
= 80 THEN 1.0" (クエリが切り捨てられています)。ステータスメッセージには「1,000 行を読み込み、ヒートマップとして 1,000 ポイントをプロットしました」と表示されています。以下はサンフランシスコの Leaflet/OpenStreetMap(※Leaflet はオープンソースのインタラクティブなウェブ地図ライブラリ)によるインタラクティブマップで、樹木の位置を示すヒートマップオーバーレイが表示されており、青緑色のクラスターがリッチモンド地区やサンセット地区など特定の地域に集中しています。マップにはズームコントロールが含まれており、「Leaflet | © OpenStreetMap 貢献者」というクレジット表記があります。
このハンドアウトは、対面でのセッションに参加できなかった人々にとっても有用となるように設計しました。通常通り、データジャーナリストを対象とした資料は、データを探索したい他のすべての人にも等しく適用可能です。
Tags: data-journalism, geospatial, python, speaking, sqlite, ai, datasette, generative-ai, llms, github-codespaces, nicar, coding-agents, claude-code, codex-cli, leaflet
原文を表示
Coding agents for data analysis
Here's the handout I prepared for my NICAR 2026 workshop "Coding agents for data analysis" - a three hour session aimed at data journalists demonstrating ways that tools like Claude Code and OpenAI Codex can be used to explore, analyze and clean data.
Here's the table of contents:
Coding agents
Warmup: ChatGPT and Claude
Setup Claude Code and Codex
Asking questions against a database
Exploring data with agents
Cleaning data: decoding neighborhood codes
Creating visualizations with agents
Scraping data with agents
I ran the workshop using GitHub Codespaces and OpenAI Codex, since it was easy (and inexpensive) to distribute a budget-restricted API key for Codex that attendees could use during the class. Participants ended up burning $23 of Codex tokens.
The exercises all used Python and SQLite and some of them used Datasette.
One highlight of the workshop was when we started running Datasette such that it served static content from a viz/ folder, then had Claude Code start vibe coding new interactive visualizations directly in that folder. Here's a heat map it created for my trees database using Leaflet and Leaflet.heat, source code here.
= 80 THEN 1.0" (query is truncated). A status message reads "Loaded 1,000 rows and plotted 1,000 points as heat map." Below is a Leaflet/OpenStreetMap interactive map of San Francisco showing a heat map overlay of tree locations, with blue/green clusters concentrated in areas like the Richmond District, Sunset District, and other neighborhoods. Map includes zoom controls and a "Leaflet | © OpenStreetMap contributors" attribution." src="https://static.simonwillison.net/static/2026/tree-sql-map.jpg" />
I designed the handout to also be useful for people who weren't able to attend the session in person. As is usually the case, material aimed at data journalists is equally applicable to anyone else with data to explore.
Tags: data-journalism, geospatial, python, speaking, sqlite, ai, datasette, generative-ai, llms, github-codespaces, nicar, coding-agents, claude-code, codex-cli, leaflet
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み