Back to skills
SkillHub ClubAnalyze Data & AIFull StackData / AI
data-analyzer
数据分析工具,使用 pandas 进行数据统计分析。当用户需要对数据进行统计分析、计算均值、求和、描述性统计时使用。
Packaged view
This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.
Stars
54
Hot score
91
Updated
March 20, 2026
Overall rating
C3.9
Composite score
3.9
Best-practice grade
B77.6
Install command
npx @skill-hub/cli install exboys-skilllite-data-analyzer
Repository
EXboys/skilllite
Skill path: .skills/data-analyzer
数据分析工具,使用 pandas 进行数据统计分析。当用户需要对数据进行统计分析、计算均值、求和、描述性统计时使用。
Open repositoryBest for
Primary workflow: Analyze Data & AI.
Technical facets: Full Stack, Data / AI.
Target audience: everyone.
License: MIT.
Original source
Catalog source: SkillHub Club.
Repository owner: EXboys.
This is still a mirrored public skill entry. Review the repository before installing into production workflows.
What it helps with
- Install data-analyzer into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
- Review https://github.com/EXboys/skilllite before adding data-analyzer to shared team environments
- Use data-analyzer for development workflows
Works across
Claude CodeCodex CLIGemini CLIOpenCode
Favorites: 0.
Sub-skills: 0.
Aggregator: No.
Original source / Raw SKILL.md
---
name: data-analyzer
description: 数据分析工具,使用 pandas 进行数据统计分析。当用户需要对数据进行统计分析、计算均值、求和、描述性统计时使用。
license: MIT
compatibility: Requires Python 3.x with pandas and numpy
metadata:
author: skillLite
version: "1.0"
---
# Data Analyzer Skill
使用 pandas 进行数据统计分析的技能。
## 功能特性
- 支持 JSON 格式数据输入
- 支持多种统计分析操作:
- `describe` - 描述性统计(均值、标准差、最小值、最大值等)
- `mean` - 计算数值列均值
- `sum` - 计算数值列求和
- `count` - 统计行数和列信息
## 使用示例
### 描述性统计
```json
{
"data": "[{\"name\": \"Alice\", \"age\": 25, \"score\": 85}, {\"name\": \"Bob\", \"age\": 30, \"score\": 92}]",
"operation": "describe"
}
```
### 计算均值
```json
{
"data": "[{\"value\": 10}, {\"value\": 20}, {\"value\": 30}]",
"operation": "mean"
}
```
## Runtime
```yaml
entry_point: scripts/main.py
language: python
dependencies:
- pandas>=2.0.0
- numpy>=1.24.0
input_schema:
type: object
properties:
data:
type: string
description: "JSON 格式的数据,如: [{\"name\": \"Alice\", \"age\": 25}, {\"name\": \"Bob\", \"age\": 30}]"
operation:
type: string
description: 分析操作类型
enum:
- describe
- mean
- sum
- count
default: describe
required:
- data
```
---
## Referenced Files
> The following files are referenced in this skill and included for context.
### scripts/main.py
```python
#!/usr/bin/env python3
"""
数据分析技能 - 使用 pandas 进行数据统计分析
依赖: pandas, numpy (通过沙箱自动安装)
"""
import json
import sys
import pandas as pd
def analyze_data(data_json: str, operation: str = "describe") -> dict:
"""
分析数据并返回统计结果
Args:
data_json: JSON 格式的数据字符串
operation: 分析操作类型 (describe/mean/sum/count)
Returns:
包含分析结果的字典
"""
try:
data = json.loads(data_json)
df = pd.DataFrame(data)
if operation == "describe":
result = df.describe(include='all').to_dict()
elif operation == "mean":
numeric_cols = df.select_dtypes(include=['number'])
result = numeric_cols.mean().to_dict()
elif operation == "sum":
numeric_cols = df.select_dtypes(include=['number'])
result = numeric_cols.sum().to_dict()
elif operation == "count":
result = {"total_rows": len(df), "columns": df.columns.tolist()}
else:
return {"error": f"不支持的操作类型: {operation}"}
return {
"success": True,
"operation": operation,
"result": result,
"shape": {"rows": df.shape[0], "columns": df.shape[1]}
}
except json.JSONDecodeError as e:
return {"success": False, "error": f"JSON 解析错误: {str(e)}"}
except Exception as e:
return {"success": False, "error": f"分析错误: {str(e)}"}
def main():
# Read input from stdin (framework passes JSON via stdin)
input_data = json.loads(sys.stdin.read())
data_json = input_data.get("data", "[]")
operation = input_data.get("operation", "describe")
result = analyze_data(data_json, operation)
# 处理 NaN 值,将其转换为 null
import math
def clean_nan(obj):
if isinstance(obj, dict):
return {k: clean_nan(v) for k, v in obj.items()}
elif isinstance(obj, list):
return [clean_nan(v) for v in obj]
elif isinstance(obj, float) and math.isnan(obj):
return None
return obj
result = clean_nan(result)
print(json.dumps(result, ensure_ascii=False, default=str))
if __name__ == "__main__":
main()
```