{"data":{"slug":"github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-visualization-bar-chart-visualization-775e6d32b141","title":"Excel Data Aggregation and Visualization Analysis","summary":"This skill reads multi-sheet Excel files, automatically processes merged cells and data cleaning, performs cross-group statistics, and generates a result table with a total row. It also creates a beautified bar chart with support for both Chinese and English fonts, suitable for multi-dimensional data aggregation and visualization analysis.","url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-visualization-bar-chart-visualization-775e6d32b141","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-visualization-bar-chart-visualization-775e6d32b141","markdown_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-visualization-bar-chart-visualization-775e6d32b141.md","download_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-visualization-bar-chart-visualization-775e6d32b141\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"The skill requires the user to prepare a multi-sheet Excel file with merged cells and data that needs cleaning. The first deliverable is a result table with a total row exported as an Excel file, and the second deliverable is a beautified bar chart with support for both Chinese and English fonts.","instructions":"---\nname: excel-bar-chart-visualization\ndescription: \"\u8bfb\u53d6\u591a\u5de5\u4f5c\u8868Excel\u6587\u4ef6\uff0c\u81ea\u52a8\u5904\u7406\u5408\u5e76\u5355\u5143\u683c\u4e0e\u6570\u636e\u6e05\u6d17\uff0c\u8fdb\u884c\u4ea4\u53c9\u5206\u7ec4\u7edf\u8ba1\u5e76\u751f\u6210\u5e26\u603b\u8ba1\u884c\u7684\u7ed3\u679c\u8868\uff0c\u6700\u540e\u7ed8\u5236\u652f\u6301\u4e2d\u82f1\u6587\u5b57\u4f53\u7684\u7f8e\u5316\u67f1\u72b6\u56fe\uff0c\u9002\u7528\u4e8e\u591a\u7ef4\u5ea6\u6570\u636e\u6c47\u603b\u4e0e\u53ef\u89c6\u5316\u5206\u6790\u3002\"\n---\n\n## Skill Steps\n\n> This sub-skill covers one capability of the Excel workflow. For reading\/counting\/Parquet optimization, see the parent workflow SKILL.md.\n\n### Step1: \u6570\u636e\u5408\u5e76\u4e0e\u6e05\u6d17\n```python\ncombined_df = pd.concat(data_frames, ignore_index=True)\n\n# \u6570\u636e\u6e05\u6d17\uff1a\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u7edf\u4e00\u547d\u540d\nif '\u9898\u578b' in combined_df.columns:\n    combined_df['\u9898\u578b'] = combined_df['\u9898\u578b'].astype(str).str.replace('\u5224', '\u5224\u65ad\u9898', regex=False)\n\n# \u5904\u7406\u5408\u5e76\u5355\u5143\u683c\u6280\u5de71\uff1a\u524d\u5411\u586b\u5145\nif '\u6d41\u7a0b\u63cf\u8ff0' in combined_df.columns:\n    combined_df['\u6d41\u7a0b\u63cf\u8ff0'] = combined_df['\u6d41\u7a0b\u63cf\u8ff0'].fillna(method='ffill')\n\n# \u5904\u7406\u5408\u5e76\u5355\u5143\u683c\u6280\u5de72\uff1a\u901a\u8fc7\u903b\u8f91\u5224\u65ad\u4e0e\u624b\u52a8\u6620\u5c04\u8fd8\u539f\u5b8c\u6574\u540d\u79f0\ngroup_col = '\u9879\u76ee\u9636\u6bb5'\ntarget_col = '\u63a7\u5236\u8981\u70b9'\nif group_col in combined_df.columns and target_col in combined_df.columns:\n    project_stages, control_points = [], []\n    current_stage = None\n    for _, row in combined_df.iterrows():\n        stage = row[group_col]\n        point = row[target_col]\n        if pd.notna(point) and point != target_col:\n            if pd.notna(stage):\n                current_stage = stage\n            project_stages.append(current_stage)\n            control_points.append(point)\n    combined_df = pd.DataFrame({\n        group_col: project_stages,\n        target_col: control_points\n    })\n```\n\n### Step2: \u4ea4\u53c9\u5206\u6790\u4e0e\u5206\u7c7b\u6620\u5c04\n```python\n# \u5206\u7c7b\u6620\u5c04\u51fd\u6570\u9aa8\u67b6\nif group_col in combined_df.columns:\n    stage_mapping = {\n        '\u788e\u7247\u503c1': '\u6807\u51c6\u5206\u7c7bA',\n        '\u788e\u7247\u503c2': '\u6807\u51c6\u5206\u7c7bA',\n        '\u788e\u7247\u503c3': '\u6807\u51c6\u5206\u7c7bB',\n        '\u5f02\u5e38\u503c': '\u5176\u4ed6'\n    }\n    combined_df[f'{group_col}_\u5408\u5e76'] = combined_df[group_col].map(stage_mapping).fillna('\u5176\u4ed6')\n    grouped_stats = combined_df.groupby(f'{group_col}_\u5408\u5e76')[target_col].count().sort_values(ascending=False)\nelif '\u9898\u76ee\u5206\u7c7b' in combined_df.columns and '\u9898\u578b' in combined_df.columns:\n    # \u4ea4\u53c9\u5206\u6790 crosstab\/pivot\n    grouped_stats = combined_df.groupby(['\u9898\u76ee\u5206\u7c7b', '\u9898\u578b']).size().unstack(fill_value=0)\nelse:\n    grouped_stats = combined_df.groupby(combined_df.columns[0]).size()\n```\n\n### Step3: \u7edf\u8ba1\u7ed3\u679c\u8f93\u51fa\u4e0e\u4e0b\u8f7d\n```python\nimport tempfile\nimport os\n\noutput_path = os.path.join(tempfile.gettempdir(), \"\u7edf\u8ba1\u7ed3\u679c.xlsx\")\n\n# \u8ba1\u7b97\u5360\u6bd4\u5e76\u751f\u6210\u5305\u542b\u603b\u8ba1\u884c\u7684Excel\u6587\u4ef6\nif isinstance(grouped_stats, pd.Series):\n    result_df = pd.DataFrame({\n        '\u5206\u7c7b': grouped_stats.index,\n        '\u6570\u91cf': grouped_stats.values,\n        '\u5360\u6bd4(%)': (grouped_stats.values \/ grouped_stats.sum() * 100).round(2)\n    })\n    total_row = pd.DataFrame({\n        '\u5206\u7c7b': ['\u603b\u8ba1'],\n        '\u6570\u91cf': [grouped_stats.sum()],\n        '\u5360\u6bd4(%)': [100.00]\n    })\n    result_df = pd.concat([result_df, total_row], ignore_index=True)\nelse:\n    result_df = grouped_stats.reset_index()\n\nresult_df.to_excel(output_path, index=False)\n\n# \u751f\u6210\u4e34\u65f6\u53ef\u8bbf\u95ee\u7684\u4e0b\u8f7d\u94fe\u63a5\ndownload_url = invoke_skill(\"file_service.get_download_url\", {\"file_path\": output_path})\nprint(f\"\u4e0b\u8f7d\u94fe\u63a5: {download_url}\")\n```\n\n### Step4: \u56fe\u8868\u7ed8\u5236\u4e0e\u7f8e\u5316\n```python\nimport matplotlib.pyplot as plt\nimport matplotlib\n\n# \u6280\u5de7\uff1a\u914d\u7f6e\u4e2d\u82f1\u6587\u5b57\u4f53\u4ee5\u786e\u4fdd\u5728\u4e0d\u540c\u7cfb\u7edf\u4e2d\u6b63\u5e38\u663e\u793a\nmatplotlib.rcParams['font.sans-serif'] = ['SimHei', 'DejaVu Sans']\nmatplotlib.rcParams['axes.unicode_minus'] = False\n\nstage_mapping_en = {\n    '\u6807\u51c6\u5206\u7c7bA': 'Standard Category A',\n    '\u6807\u51c6\u5206\u7c7bB': 'Standard Category B',\n    '\u5176\u4ed6': 'Others'\n}\n\nif isinstance(grouped_stats, pd.Series):\n    stage_counts_sorted = grouped_stats.sort_values(ascending=True)\n    stage_counts_en = stage_counts_sorted.rename(index=stage_mapping_en)\n    \n    # \u56fe\u8868\u7f8e\u5316\uff08dpi\u3001\u989c\u8272\u65b9\u6848\u3001\u6807\u7b7e\u4f4d\u7f6e\uff09\n    fig, ax = plt.subplots(figsize=(12, 8), dpi=120)\n    colors = plt.cm.Set3(range(len(stage_counts_en)))\n    bars = ax.barh(stage_counts_en.index, stage_counts_en.values, color=colors, edgecolor='black', linewidth=0.5)\n    \n    for bar, value in zip(bars, stage_counts_en.values):\n        ax.text(bar.get_width() + (stage_counts_en.max() * 0.01), \n                bar.get_y() + bar.get_height()\/2, \n                str(value), va='center', ha='left', fontsize=11, fontweight='bold')\n                \n    ax.set_xlabel('Count', fontsize=12, fontweight='bold')\n    ax.set_ylabel('Category', fontsize=12, fontweight='bold')\n    plt.tight_layout()\n```\n","use_cases":["Merge and clean data from multiple Excel sheets to generate a statistical result table.","Perform cross-analysis on data to generate categorized statistical results.","Generate a statistical result table with a total row and export it as an Excel file.","Create a beautified bar chart with support for both Chinese and English fonts for data visualization analysis."],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/OpenSenseNova\/SenseNova-Skills\/blob\/07e7ff8c4bdfd7b79e7402fe94af59d2a5a9749b\/skills\/sn-da-excel-workflow\/capability\/excel-data-visualization\/bar-chart-visualization\/SKILL.md","source_commit":"07e7ff8c4bdfd7b79e7402fe94af59d2a5a9749b","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-15T08:39:31.000000Z","updated_at":"2026-11-16T05:16:30.000000Z","seo_title":"Excel Data Aggregation and Visualization Analysis Tool","seo_description":"Automatically process Excel data merging and cleaning, generate statistical result tables, and create beautified bar charts, suitable for multi-dimensional data summariza","seo_keywords":["Excel data aggregation","Excel visualization analysis","data cleaning and statistics","bar chart generation tool","multi-sheet data processing"]}}