Data Q&A skill for immediate numeric answers and conclusions. Use when users ask "what is xx metric?", "which xx is best?", "how is xx growth rate?" or need instant numeric answers/conclusions from data. Answers based on Python script calculation only.
Precisely calculate data through Python scripts, provide immediate accurate numeric answers and business explanations. Directly reading data produces hallucinations; must use script complete calculation.
Data analysis code must be executed via run_python_snippet tool.
# Step 1: 使用 run_python_snippet 执行 Python 代码
run_python_snippet(
python_code="""
import json
import pandas as pd
df = pd.read_csv('path/to/data.csv')
metric = df['column'].sum() # 完整计算,勿仅读取片段
print(json.dumps({'answer': metric, 'explanation': '...'}))
""",
script_path="temp_data_qa.py",
cwd="工作区根目录"
)
# Step 2: 解析 result.content 获取计算结果
# Step 3: 基于计算结果用自然语言回答用户问题
Key: Script must process complete data and output structured result (e.g. JSON). Strictly prohibited to answer by directly reading file snippets.
Directly reading data produces hallucinations, misleading decisions. Only through script complete calculation can accurate results be obtained.
User asks numeric data question? ├─ Yes → Write run_python_snippet script to calculate └─ No → Do not use this skill
Data format? ├─ CSV/Excel → pandas read, full calculation, print(json.dumps(...)) ├─ JSON → json.load + processing logic └─ Other → See data processing instructions below
When scenarios involve data analysis, write Python scripts for analysis: