data-analysis
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseData Analysis
数据分析
Part of Agent Skills™ by googleadsagent.ai™
由 googleadsagent.ai™ 提供的 Agent Skills™ 的一部分
Description
描述
Data Analysis provides a structured framework for statistical analysis using pandas, numpy, and scipy, with visualization through matplotlib, seaborn, and plotly. The agent follows a rigorous pipeline from data ingestion and cleaning through exploratory analysis, statistical testing, and publication-quality visualization, ensuring reproducibility at every step.
Scientific data analysis is not exploratory coding—it is a disciplined process where every transformation is justified, every statistical test has verified assumptions, and every visualization accurately represents the underlying data. This skill enforces that discipline by requiring the agent to document data provenance, validate distributions before applying parametric tests, and report effect sizes alongside p-values.
The visualization layer produces figures suitable for journal submission: proper axis labels with units, colorblind-safe palettes, appropriate figure sizes for single or double-column layouts, and vector output formats (SVG, PDF). Interactive plotly visualizations are generated for exploratory work; static matplotlib/seaborn figures for publication.
数据分析使用 pandas、numpy 和 scipy 提供结构化的统计分析框架,并通过 matplotlib、seaborn 和 plotly 实现可视化。Agent 遵循一套严谨的流水线,涵盖数据摄取与清理、探索性分析、统计检验和出版级可视化,确保每个步骤均可复现。
科学数据分析并非简单的探索性编码,而是一个严谨 disciplined 的过程:每次转换都有充分依据,每项统计检验都会验证相关假设,每张可视化图表都能准确呈现底层数据。该 skill 通过强制要求 Agent 记录数据来源、在应用参数检验前验证分布,并在报告 p 值的同时报告效应量,来确保分析过程的严谨性。
可视化层可生成适合期刊投稿的图表:包含单位和恰当的坐标轴标签、采用色盲友好型配色、针对单栏或双栏排版设置适当的图形尺寸,并支持矢量输出格式(SVG、PDF)。探索性工作会生成交互式 plotly 可视化,出版用途则采用静态 matplotlib/seaborn 图形。
Use When
使用场景
- Performing statistical analysis on experimental or observational data
- Cleaning and transforming datasets for downstream analysis
- Creating publication-quality figures and plots
- Running hypothesis tests with proper assumption checking
- Exploratory data analysis on new datasets
- Building reproducible analysis pipelines
- 对实验数据或观察性数据进行统计分析
- 清理和转换数据集,以供下游分析使用
- 创建出版级图表
- 在正确检查假设条件的前提下运行假设检验
- 对新数据集执行探索性数据分析
- 构建可复现的分析流水线
How It Works
工作原理
mermaid
graph TD
A[Raw Data] --> B[Ingest + Validate Schema]
B --> C[Clean: Missing Values, Outliers, Types]
C --> D[Exploratory Data Analysis]
D --> E[Distribution Assessment]
E --> F{Parametric Assumptions Met?}
F -->|Yes| G[Parametric Tests]
F -->|No| H[Non-Parametric Tests]
G --> I[Effect Size + Confidence Intervals]
H --> I
I --> J[Publication Visualization]
J --> K[Reproducible Report]The pipeline enforces assumption checking before test selection. Parametric tests (t-test, ANOVA) require normality and homoscedasticity; when assumptions fail, the agent automatically selects non-parametric alternatives (Mann-Whitney, Kruskal-Wallis).
mermaid
graph TD
A[Raw Data] --> B[Ingest + Validate Schema]
B --> C[Clean: Missing Values, Outliers, Types]
C --> D[Exploratory Data Analysis]
D --> E[Distribution Assessment]
E --> F{Parametric Assumptions Met?}
F -->|Yes| G[Parametric Tests]
F -->|No| H[Non-Parametric Tests]
G --> I[Effect Size + Confidence Intervals]
H --> I
I --> J[Publication Visualization]
J --> K[Reproducible Report]该流水线会在选择检验方法之前强制检查假设条件。参数检验(t-test、ANOVA)要求满足正态性和方差齐性;当假设条件不成立时,Agent 会自动选择非参数替代方法(Mann-Whitney、Kruskal-Wallis)。
Implementation
实现
python
import pandas as pd
import numpy as np
from scipy import stats
import seaborn as sns
import matplotlib.pyplot as plt
def analysis_pipeline(filepath: str) -> dict:
df = pd.read_csv(filepath)
report = {
"shape": df.shape,
"missing": df.isnull().sum().to_dict(),
"dtypes": df.dtypes.astype(str).to_dict(),
}
numeric_cols = df.select_dtypes(include=[np.number]).columns
for col in numeric_cols:
stat, p = stats.shapiro(df[col].dropna()[:5000])
report[f"{col}_normality"] = {"statistic": stat, "p_value": p, "normal": p > 0.05}
return report
def compare_groups(df: pd.DataFrame, value_col: str, group_col: str) -> dict:
groups = [g[value_col].dropna() for _, g in df.groupby(group_col)]
normality_ok = all(stats.shapiro(g[:5000]).pvalue > 0.05 for g in groups)
_, levene_p = stats.levene(*groups)
homoscedastic = levene_p > 0.05
if normality_ok and homoscedastic:
stat, p = stats.f_oneway(*groups) if len(groups) > 2 else stats.ttest_ind(*groups)
test_name = "ANOVA" if len(groups) > 2 else "t-test"
else:
stat, p = stats.kruskal(*groups)
test_name = "Kruskal-Wallis"
effect = compute_cohens_d(groups[0], groups[1]) if len(groups) == 2 else compute_eta_squared(groups)
return {"test": test_name, "statistic": stat, "p_value": p, "effect_size": effect}
def publication_figure(df: pd.DataFrame, x: str, y: str, output: str):
fig, ax = plt.subplots(figsize=(3.5, 3)) # Single-column journal width
sns.boxplot(data=df, x=x, y=y, palette="colorblind", ax=ax)
ax.set_xlabel(x.replace("_", " ").title())
ax.set_ylabel(y.replace("_", " ").title())
sns.despine()
fig.tight_layout()
fig.savefig(output, dpi=300, bbox_inches="tight")
plt.close(fig)python
import pandas as pd
import numpy as np
from scipy import stats
import seaborn as sns
import matplotlib.pyplot as plt
def analysis_pipeline(filepath: str) -> dict:
df = pd.read_csv(filepath)
report = {
"shape": df.shape,
"missing": df.isnull().sum().to_dict(),
"dtypes": df.dtypes.astype(str).to_dict(),
}
numeric_cols = df.select_dtypes(include=[np.number]).columns
for col in numeric_cols:
stat, p = stats.shapiro(df[col].dropna()[:5000])
report[f"{col}_normality"] = {"statistic": stat, "p_value": p, "normal": p > 0.05}
return report
def compare_groups(df: pd.DataFrame, value_col: str, group_col: str) -> dict:
groups = [g[value_col].dropna() for _, g in df.groupby(group_col)]
normality_ok = all(stats.shapiro(g[:5000]).pvalue > 0.05 for g in groups)
_, levene_p = stats.levene(*groups)
homoscedastic = levene_p > 0.05
if normality_ok and homoscedastic:
stat, p = stats.f_oneway(*groups) if len(groups) > 2 else stats.ttest_ind(*groups)
test_name = "ANOVA" if len(groups) > 2 else "t-test"
else:
stat, p = stats.kruskal(*groups)
test_name = "Kruskal-Wallis"
effect = compute_cohens_d(groups[0], groups[1]) if len(groups) == 2 else compute_eta_squared(groups)
return {"test": test_name, "statistic": stat, "p_value": p, "effect_size": effect}
def publication_figure(df: pd.DataFrame, x: str, y: str, output: str):
fig, ax = plt.subplots(figsize=(3.5, 3)) # Single-column journal width
sns.boxplot(data=df, x=x, y=y, palette="colorblind", ax=ax)
ax.set_xlabel(x.replace("_", " ").title())
ax.set_ylabel(y.replace("_", " ").title())
sns.despine()
fig.tight_layout()
fig.savefig(output, dpi=300, bbox_inches="tight")
plt.close(fig)Best Practices
最佳实践
- Always check normality and homoscedasticity before selecting parametric tests
- Report effect sizes (Cohen's d, eta-squared) alongside p-values—significance without magnitude is meaningless
- Use colorblind-safe palettes (,
colorblind) for all visualizationsviridis - Set random seeds for any stochastic operation to ensure reproducibility
- Document every data transformation with inline comments explaining the rationale
- Export figures as vector formats (SVG, PDF) for publication, raster (PNG) for web
- 在选择参数检验之前,始终检查正态性和方差齐性
- 报告效应量(Cohen's d、eta-squared)时同时提供 p 值——只有显著性而没有效应大小毫无意义
- 所有可视化均使用色盲友好型配色(、
colorblind)viridis - 为任何随机操作设置随机种子,以确保可复现性
- 使用行内注释记录每次数据转换,并说明其依据
- 出版用途的图形导出为矢量格式(SVG、PDF),Web 用途则导出为栅格格式(PNG)
Platform Compatibility
平台兼容性
| Platform | Support | Notes |
|---|---|---|
| Cursor | Full | Jupyter + Python execution |
| VS Code | Full | Jupyter notebook support |
| Windsurf | Full | Python environment |
| Claude Code | Full | Script execution |
| Cline | Full | Data analysis workflows |
| aider | Partial | Code generation only |
| 平台 | 支持情况 | 备注 |
|---|---|---|
| Cursor | 完全支持 | Jupyter + Python 执行 |
| VS Code | 完全支持 | 支持 Jupyter notebook |
| Windsurf | 完全支持 | Python 环境 |
| Claude Code | 完全支持 | 脚本执行 |
| Cline | 完全支持 | 数据分析工作流 |
| aider | 部分支持 | 仅支持代码生成 |
Related Skills
相关 Skill
- Machine Learning
- Scientific Writing
- Research Methodology
- Knowledge Base RAG
- 机器学习
- 科学写作
- 研究方法
- 知识库 RAG
Keywords
关键词
data-analysisstatisticspandasscipyvisualizationmatplotlibseabornhypothesis-testingpublication-figures© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License
data-analysisstatisticspandasscipyvisualizationmatplotlibseabornhypothesis-testingpublication-figures© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License