본문으로 건너뛰기
cccskills
무료GitHub에 공개

excel-data-analysis-and-report-generation

Analyze Excel data by classifying items, calculating counts and percentages, and comparing categories across groups. Identify values above related limits, then produce a pie chart and an Excel statistics file with download links.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

从Excel提取多类型数据,并生成包含可视化图表与下载链接的综合分析报告。

연동 도구Excel
설치 방법 보기

이럴 때 유용합니다

  • Summarizing category counts and percentages
  • Comparing categories across regions or other groups
  • Finding values that exceed related limits
  • Exporting statistics and a category pie chart

포함된 파일(1)

  • SKILL.md4.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Skill Steps

This sub-skill covers one capability of the Excel workflow. For reading/counting/Parquet optimization, see the parent workflow SKILL.md.

Step1 基于指定列提取有效代码或进行分类映射,生成包含占比与总计行的统计表,并支持交叉分析。

# 分类映射函数骨架
def categorize_item(item_name):
    category_a_keywords = ['keyword1', 'keyword2'] # 占位示例
    if pd.isna(item_name):
        return '未知'
    if any(kw in str(item_name) for kw in category_a_keywords):
        return '类别A'
    return '其他'

target_col = '项目名称' # 替换为实际列名
group_col = '所属区域'  # 替换为实际分组列名

if target_col in combined_df.columns:
    combined_df['分类'] = combined_df[target_col].apply(categorize_item)
    
    # value_counts + 占比 + 总计行
    category_counts = combined_df['分类'].value_counts().reset_index()
    category_counts.columns = ['类别', '数量']
    total = category_counts['数量'].sum()
    category_counts['占比'] = (category_counts['数量'] / total).apply(lambda x: f'{x:.2%}')
    
    total_row = pd.DataFrame([{'类别': '总计', '数量': total, '占比': '100.00%'}])
    category_counts = pd.concat([category_counts, total_row], ignore_index=True)
    
    # 交叉分析 crosstab
    if group_col in combined_df.columns:
        cross_tb = pd.crosstab(combined_df[group_col], combined_df['分类'], margins=True, margins_name='总计')
        print("交叉分析结果:\n", cross_tb)

Step2 识别目标值超过限值的行,基于关键字定位并反向搜索限值以确保数据关联。

import re

exceed_rows = []
df_target = combined_df.copy()

for i, row in df_target.iterrows():
    if '共计' in str(row.iloc[0]):
        try:
            target_val = float(row.iloc[8]) # 目标值所在列索引
        except (ValueError, TypeError):
            continue
        
        limit_val = None
        structure_name = "未知结构"
        
        # 反向搜索限值
        for j in range(i-1, max(0, i-15), -1):
            check_row = df_target.iloc[j, :]
            check_str = ' '.join([str(x) for x in check_row.values if pd.notna(x)])
            if '限值' in check_str:
                # 数据清洗正则表达式
                match = re.search(r'限值([\d.]+)', check_str)
                if match:
                    limit_val = float(match.group(1))
                    for k in range(j-1, max(0, j-5), -1):
                        name_row = df_target.iloc[k, 0]
                        if pd.notna(name_row) and '关键字' in str(name_row):
                            structure_name = str(name_row)
                            break
                    break
        
        # 多维度评分/分级算法结构
        if limit_val is not None and target_val > limit_val:
            severity = '高' if (target_val - limit_val) > 10 else '中'
            exceed_rows.append({
                'row_index': i,
                'structure_name': structure_name,
                'target_val': target_val,
                'limit': limit_val,
                'exceed_value': target_val - limit_val,
                'severity': severity
            })

Step3 生成高分辨率可视化图表展示分类占比,保存统计结果并生成沙箱下载链接。

import matplotlib.pyplot as plt
import matplotlib

# 中英文字体配置
matplotlib.rcParams['font.sans-serif'] = ['SimHei', 'DejaVu Sans']
matplotlib.rcParams['axes.unicode_minus'] = False

# 准备图表数据 (排除总计行)
plot_data = category_counts[category_counts['类别'] != '总计']
categories = plot_data['类别'].tolist()
counts = plot_data['数量'].tolist()

# 图表美化(dpi、颜色方案、标签位置)
fig, ax = plt.subplots(figsize=(10, 8))
colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#F9A826']
explode = [0.05] * len(categories)

wedges, texts, autotexts = ax.pie(
    counts, 
    labels=categories, 
    autopct='%1.1f%%',
    startangle=90,
    colors=colors[:len(categories)],
    explode=explode,
    shadow=True,
    textprops={'fontsize': 12}
)

ax.set_title('各类别数量占比分析', fontsize=16, fontweight='bold', pad=20)
ax.legend(wedges, categories, title="类别", loc="center left", bbox_to_anchor=(1, 0, 0.5, 1))

# 保存图表
chart_path = os.path.join(output_dir, 'category_analysis.png')
plt.savefig(chart_path, dpi=150, bbox_inches='tight')

# 保存统计结果并生成下载链接
output_path = os.path.join(output_dir, 'analysis_result.xlsx')
category_counts.to_excel(output_path, index=False)

print(f"统计结果已保存至: {output_path}")
print(f"下载链接: [下载统计结果](sandbox:{output_path})")
print(f"图表下载链接: [下载图表](sandbox:{chart_path})")

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Compare counts and shares for two categories in Excel data. The skill cleans the selected columns, calculates differences and percentages, and produces a summary spreadsheet plus bar and pie charts.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Comparing counts for two categories
  • Visualizing category shares
  • Cleaning merged-cell data before counting
OpenSenseNova/SenseNova-Skills5.9천2026년 10월 9일 업데이트

Analyze Excel data using custom categories, count distributions, and compare groups with charts. Score text using its length, technical terms, numbers, and selected complex concepts, then visualize difficulty levels and the relationship between text length and scores.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Summarize Excel records using custom categories
  • Compare category distributions across groups
  • Score and grade text using adjustable rules
OpenSenseNova/SenseNova-Skills5.9천2026년 10월 9일 업데이트

Count categories in a chosen data column after removing missing values and placeholder labels. Calculate each category’s share and create high-resolution charts combining counts, percentages, pie charts, and horizontal bars for distribution reports.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Compare record counts across categories
  • Show category shares with pie and bar charts
  • Exclude placeholder labels before counting
OpenSenseNova/SenseNova-Skills5.9천2026년 10월 9일 업데이트

Clean category and numeric fields in structured data, compare groups with counts and cross-tabulations, and produce charts, Excel results, and a Markdown report. Export visuals as high-resolution PNG and SVG files for use in reports.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Compare category distributions across groups
  • Clean category labels and fill merged-cell gaps
  • Export analysis results to Excel
OpenSenseNova/SenseNova-Skills5.9천2026년 10월 9일 업데이트

Filter Excel data using candidate column names, RGB color values, text prefixes, and regular expressions, which match text patterns. Calculate totals and averages, then export results to Excel with highlighted rows and a download link.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Filtering rows by RGB values or identifier prefixes
  • Converting text to numbers and calculating totals or averages
  • Extracting matching commands with their identifiers and descriptions
OpenSenseNova/SenseNova-Skills5.9천2026년 10월 9일 업데이트

Filter rows from Excel or previously converted Parquet files, a format designed for efficient data storage. Summarize matching records by group with counts, percentages, and totals, then export the summary to Excel.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Count records containing a specified risk level by work category
  • Calculate group shares among matching records
  • Summarize large datasets already converted to Parquet
OpenSenseNova/SenseNova-Skills5.9천2026년 10월 9일 업데이트

OpenSenseNova의 스킬 모두 보기

이 스킬의 문제 신고