Python 数据分析

Python 数据分析 is a skill for Claude Code, Codex from Changan-Su/Forsion. It costs 37 tokens per session (1,286 once invoked), scanned A, original, Apache-2.0.

A set of instructions for using Python, a programming language, and pandas, a library for working with tables of data. It covers analysing files, calculating statistics, grouping data and making charts.

In plain words
What is it for?
It is for cleaning and summarising datasets, calculating grouped statistics and creating data visualisations.
Why use it?
It provides standard ways to analyse data files and specifies how to run the required Python code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for cleaning and summarising datasets, calculating grouped statistics and creating data visualisations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/changan-su/forsion/data-analysis-python
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Changan-Su/Forsion --skill data-analysis-python
Clone the repo
git clone --depth 1 https://github.com/Changan-Su/Forsion

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Python 数据分析

README.md
[![agentmods](https://agentmods.dev/badge/skills/changan-su/forsion/data-analysis-python/github.svg)](https://agentmods.dev/skills/changan-su/forsion/data-analysis-python)
Your own site
<a href="https://agentmods.dev/skills/changan-su/forsion/data-analysis-python"><img src="https://agentmods.dev/badge/skills/changan-su/forsion/data-analysis-python/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for Python 数据分析

Your own site · 80×15
<a href="https://agentmods.dev/skills/changan-su/forsion/data-analysis-python"><img src="https://agentmods.dev/badge/skills/changan-su/forsion/data-analysis-python.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,286 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00037 $0.01286
Opus 5.5 $0.00015 $0.00514
Sonnet 5.5 $0.00007 $0.00257
Haiku 4.5 $0.00004 $0.00129

Measured 3mo ago against content hash 8b4c71f6a5c2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

Python 数据分析 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

tangu-agent/skills/data-analysis-python/SKILL.md · 123 lines

How it starts

The opening of the file, as written. The whole thing — 123 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Python 数据分析

run_python 使用原则

  • 一次写完整脚本,而非碎片化多轮:把"读取→清洗→分析→输出"写成一个完整脚本一次执行。多轮小片段会浪费轮次且容易丢状态。
  • 例外:首次接触未知数据时,允许先跑一个小探查脚本(只看 shape/dtypes/head),据此再写完整分析脚本,总共两轮。
  • 脚本里所有结论性数字都要 print 出来,图表保存为文件并打印保存路径,不要依赖交互式显示。
  • 出错时整体修复脚本重跑,不要打补丁式追加片段。

第一步:探查数据(不要盲写分析)

import pandas as pd
df = pd.read_csv(path)  # 编码报错时依次试 encoding='utf-8-sig' / 'gbk'
print(df.shape)
print(df.dtypes)
print(df.head(10))
print(df.isna().sum())
print(df.describe(include='all').T)

确认列名、类型、缺失情况后,再写正式分析。

清洗标准模式

# 列名规整
df.columns = df.columns.str.strip()
# 类型转换:失败置 NaN 而不是抛错,便于统计坏行
df['amount'] = pd.to_numeric(df['amount'], errors='coerce')
df['date'] = pd.to_datetime(df['date'], errors='coerce')
bad = df['amount'].isna().sum()
print(f'无法解析的 amount 行数: {bad}')   # 坏数据要报告,不能静默丢弃
# 去重与缺失处理(策略要在结论里说明)
df = df.drop_duplicates()
df = df.dropna(subset=['date'])           # 关键列缺失才删行

原则:每一步清洗丢弃了多少数据必须 print 报告;不擅自用均值填充等改变分布的操作,除非用户同意。

聚合分析标准模式

# 分组聚合
g = (df.groupby('category')
       .agg(总额=('amount','sum'), 单数=('amount','count'), 均值=('amount','mean'))
       .sort_values('总额', ascending=False))
print(g.round(2))

# 时间序列:按月汇总
m = df.set_index('date').resample('MS')['amount'].sum()
print(m)

# 同比/环比
print(m.pct_change().round(4))

# 透视表
p = pd.pivot_table(df, index='region', columns='category',
                   values='amount', aggfunc='sum', fill_value=0)

matplotlib 中文字体处理(必做)

中文标签直接绘图会变方框,先探测可用字体:

import matplotlib
import matplotlib.pyplot as plt
from matplotlib import font_manager
# 按优先级找系统里存在的中文字体
for f in ['Noto Sans CJK SC','WenQuanYi Micro Hei','SimHei','PingFang SC','Microsoft YaHei']:
    if any(f in x.name for x in font_manager.fontManager.ttflist):
        matplotlib.rcParams['font.sans-serif'] = [f]
        break
matplotlib.rcParams['axes.unicode_minus'] = False  # 负号正常显示

若全都不存在,回退方案:图表用英文标签,结论文字里用中文解释。

绘图输出规范:

fig, ax = plt.subplots(figsize=(10, 6), dpi=120)
g['总额'].plot(kind='bar', ax=ax)
ax.set_title('各品类销售总额')
ax.set_xlabel('品类'); ax.set_ylabel('金额(元)')
plt.tight_layout()
out = '/tmp/category_sales.png'
plt.savefig(out); plt.close()
print(f'图表已保存: {out}')

Read the full file on GitHub · 123 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 123 lines · 37 tokens per session scan A 8b4c71f6a5c2

Subscribe to this mod's changes

Python 数据分析 is a skill published in the GitHub repository Changan-Su/Forsion (223 stars, last pushed today), licensed Apache-2.0. It adds 37 tokens to every session and 1,286 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Python 数据分析 compared with skills from other repositories

Python 数据分析 next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
Python 数据分析Changan-Su/ForsionSkill223todayApache-2.0A37Claude Code, Codex
infographicPM-Shawn/Abu-CoworkSkill426yesterdayApache-2.0A71Claude Code
initPM-Shawn/Abu-CoworkSkill426yesterdayApache-2.0A21Claude Code
Release Notes GeneratorAgentEra/AgentlySkill1.7k18d agoApache-2.0A46Claude Code, Codex
alert-sopPM-Shawn/Abu-CoworkSkill426yesterdayApache-2.0A20Claude Code
reflectPM-Shawn/Abu-CoworkSkill426yesterdayApache-2.0A57Claude Code
schedulePM-Shawn/Abu-CoworkSkill426yesterdayApache-2.0A16Claude Code