alchaincyf/huashu-skills / huashu-data-pro
huashu-data-pro
Verified数据分析与办公提效全能助手。覆盖数据处理、分析洞察、报告撰写、PPT制作、数据可视化的端到端工作流。 始终从专家视角出发,帮用户多想一步。遇到不确定的问题主动与用户确认。 支持:Excel数据分析、投放数据复盘、ROI测算、数据可视化、报告生成、PPT制作、公式生成。 当用户提到"分析数据"、"做报告"、"做PPT"、"Excel"、"投放分析"、"ROI"、"复盘"、 "周报"、"月报"、"数据处理"、"图表"、"可视化"、"汇报"、"表格"、"公式"时使用此技能。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 6.9 KB |
| references/ad-analytics.md | markdown | 1.4 KB |
| references/html-templates.md | markdown | 16.4 KB |
| references/report-style-gallery.md | markdown | 9.5 KB |
| references/visual-design-system.md | markdown | 18.1 KB |
| references/workflows.md | markdown | 6.6 KB |
| scripts/build_pptx.js | script | 6.9 KB |
| scripts/html2pptx.jsexecutable | script | 33.7 KB |
| scripts/read_excel.py | script | 3.8 KB |
| scripts/read_pptx.py | script | 7.4 KB |
scripts/read_excel.py
View on GitHub#!/usr/bin/env python3
"""
read_excel.py — 读取 Excel 文件并输出结构化摘要
用法:
python3 read_excel.py data.xlsx
python3 read_excel.py data.xlsx --sheet "Sheet1"
python3 read_excel.py data.xlsx --format csv
python3 read_excel.py data.xlsx --summary
python3 read_excel.py data.xlsx --head 20
参数:
文件路径 Excel 文件(.xlsx / .xls)
--sheet NAME 指定工作表名称(默认读取所有)
--format FMT 输出格式:markdown(默认)/ csv / json
--summary 仅输出数据概览(行列数、字段类型、空值统计)
--head N 仅输出前 N 行(默认全部)
依赖:
pip install openpyxl pandas
"""
import sys
import json
import argparse
def ensure_dependencies():
"""检查并提示安装依赖"""
missing = []
try:
import pandas
except ImportError:
missing.append('pandas')
try:
import openpyxl
except ImportError:
missing.append('openpyxl')
if missing:
print(f"缺少依赖: {', '.join(missing)}", file=sys.stderr)
print(f"请运行: pip install {' '.join(missing)}", file=sys.stderr)
sys.exit(1)
ensure_dependencies()
import pandas as pd
def read_excel(filepath, sheet_name=None, output_format='markdown', summary_only=False, head=None):
"""读取 Excel 并格式化输出"""
try:
# 读取所有工作表或指定工作表
if sheet_name:
sheets = {sheet_name: pd.read_excel(filepath, sheet_name=sheet_name)}
else:
sheets = pd.read_excel(filepath, sheet_name=None)
except Exception as e:
print(f"读取失败: {e}", file=sys.stderr)
sys.exit(1)
for name, df in sheets.items():
print(f"\n{'='*60}")
print(f"工作表: {name}")
print(f"{'='*60}")
print(f"行数: {len(df)} | 列数: {len(df.columns)}")
if summary_only:
print(f"\n字段信息:")
print(f"{'字段名':<30} {'类型':<15} {'非空数':<10} {'空值率'}")
print(f"{'-'*30} {'-'*15} {'-'*10} {'-'*10}")
for col in df.columns:
dtype = str(df[col].dtype)
non_null = df[col].count()
null_pct = f"{(1 - non_null/len(df))*100:.1f}%" if len(df) > 0 else "N/A"
print(f"{str(col):<30} {dtype:<15} {non_null:<10} {null_pct}")
# 数值列的基础统计
numeric_cols = df.select_dtypes(include=['number']).columns
if len(numeric_cols) > 0:
print(f"\n数值统计:")
desc = df[numeric_cols].describe()
print(desc.to_string())
continue
# 限制行数
display_df = df.head(head) if head else df
if output_format == 'markdown':
print(f"\n{display_df.to_markdown(index=False)}")
elif output_format == 'csv':
print(f"\n{display_df.to_csv(index=False)}")
elif output_format == 'json':
print(f"\n{display_df.to_json(orient='records', force_ascii=False, indent=2)}")
if head and head < len(df):
print(f"\n... 已显示前 {head} 行,共 {len(df)} 行")
def main():
parser = argparse.ArgumentParser(description='读取 Excel 文件')
parser.add_argument('filepath', help='Excel 文件路径')
parser.add_argument('--sheet', help='指定工作表名称')
parser.add_argument('--format', choices=['markdown', 'csv', 'json'], default='markdown', help='输出格式')
parser.add_argument('--summary', action='store_true', help='仅输出数据概览')
parser.add_argument('--head', type=int, help='仅输出前 N 行')
args = parser.parse_args()
read_excel(args.filepath, args.sheet, args.format, args.summary, args.head)
if __name__ == '__main__':
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |