{"data":{"slug":"github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-cleaning-missing-value-handling-d1c1b9d2b9b0","title":"Excel Smart Cleaning and Analysis","summary":"Perform intelligent cleaning, cross-sheet verification, and visualization analysis on multi-sheet Excel files, generating styled results and download links.","url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-cleaning-missing-value-handling-d1c1b9d2b9b0","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-cleaning-missing-value-handling-d1c1b9d2b9b0","markdown_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-cleaning-missing-value-handling-d1c1b9d2b9b0.md","download_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-cleaning-missing-value-handling-d1c1b9d2b9b0\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"The tool requires Python with pandas, openpyxl, and matplotlib installed. It processes merged cell data, performs regex normalization, and generates styled Excel outputs with download links.","instructions":"---\nname: excel-smart-analysis-and-cleaning\ndescription: \"\u5bf9\u591a Sheet Excel \u8fdb\u884c\u667a\u80fd\u6e05\u6d17\u3001\u8de8\u8868\u6838\u5bf9\u4e0e\u53ef\u89c6\u5316\u5206\u6790\u3002\u3002\"\n---\n\nStep1 \u5bf9\u6570\u636e\u8fdb\u884c\u6df1\u5ea6\u6e05\u6d17\uff0c\u5305\u62ec\u5408\u5e76\u5355\u5143\u683c\u586b\u5145\uff08ffill\uff09\u3001\u6b63\u5219\u5316\u6587\u672c\u5904\u7406\u3001RGB \u989c\u8272\u5206\u91cf\u8f6c\u6362\u4ee5\u53ca\u5f02\u5e38\u503c\u8bc6\u522b\u3002\n```python\nimport re\n\ndef clean_data(df, target_col):\n    # 1. \u5904\u7406\u5408\u5e76\u5355\u5143\u683c\uff1a\u5411\u4e0b\u586b\u5145\n    df[target_col] = df[target_col].ffill()\n    \n    # 2. \u6b63\u5219\u6e05\u6d17\uff1a\u53bb\u9664\u6570\u5b57\u524d\u7f00\u3001\u7279\u6b8a\u5b57\u7b26\u53ca\u9996\u5c3e\u7a7a\u683c\n    def regex_clean(text):\n        if not isinstance(text, str): return text\n        text = re.sub(r'^\\d+[\\.\\s\\-]+', '', text) # \u53bb\u9664\u5982 \"1. \" \u7684\u524d\u7f00\n        text = re.sub(r'[^\\u4e00-\\u9fa5a-zA-Z0-9]', '', text) # \u4ec5\u4fdd\u7559\u4e2d\u82f1\u6570\n        return text.strip()\n    \n    df[target_col] = df[target_col].apply(regex_clean)\n    \n    # 3. \u6570\u503c\u8f6c\u6362\u4e0e RGB \u903b\u8f91\u7b5b\u9009\uff08\u793a\u4f8b\uff1a\u7b5b\u9009\u9ed1\u8272\/\u65e0\u8272\u503c\uff09\n    # \u5047\u8bbe\u5217\u540d\u4e3a 'Red', 'Green', 'Blue'\n    rgb_cols = ['Red', 'Green', 'Blue']\n    for col in rgb_cols:\n        if col in df.columns:\n            df[col] = pd.to_numeric(df[col], errors='coerce').fillna(0)\n    \n    if all(c in df.columns for c in rgb_cols):\n        black_mask = (df['Red'] == 0) & (df['Green'] == 0) & (df['Blue'] == 0)\n        df = df[black_mask]\n        \n    return df\n\n# \u904d\u5386\u6240\u6709 sheet \u8fdb\u884c\u6e05\u6d17\ncleaned_dfs = {name: clean_data(df, 'group_col') for name, df in df_dict.items()}\n```\n\nStep2 \u6267\u884c\u8de8\u8868\u6838\u5bf9\u4e0e\u591a\u7ef4\u5ea6\u7edf\u8ba1\u5206\u6790\uff08\u5982\u4ea4\u53c9\u5206\u6790\u3001\u5360\u6bd4\u7edf\u8ba1\uff09\uff0c\u5e76\u8bc6\u522b\u5173\u952e\u6307\u6807\uff08\u5982\u95ee\u9898\u53d1\u73b0\u7387\uff09\u3002\n```python\n# \u8de8\u8868\u6838\u5bf9\u793a\u4f8b\uff1a\u6838\u5bf9 Sheet1 \u4e0e Sheet2 \u7684\u6570\u503c\u5408\u8ba1\nif 'Sheet1' in cleaned_dfs and 'Sheet2' in cleaned_dfs:\n    val1 = cleaned_dfs['Sheet1']['amount'].sum()\n    val2 = cleaned_dfs['Sheet2']['amount'].sum()\n    print(f\"\u6838\u5bf9\u7ed3\u679c: Sheet1({val1}) vs Sheet2({val2}), \u5dee\u5f02: {val1 - val2}\")\n\n# \u4ea4\u53c9\u5206\u6790\u4e0e\u5360\u6bd4\u7edf\u8ba1\ntarget_df = pd.concat(cleaned_dfs.values(), ignore_index=True)\npivot_table = pd.crosstab(target_df['category_col'], target_df['status_col'])\npivot_table['\u5360\u6bd4'] = pivot_table.sum(axis=1) \/ pivot_table.sum().sum()\n\n# \u7edf\u8ba1\u7279\u5b9a\u6761\u4ef6\u4e0b\u7684\u6700\u5927\u503c\uff08\u5982\u914d\u5408\u6bd4\u4e2d\u7684\u6700\u5927\u7528\u91cf\uff09\n# df.groupby('id_col')['value_col'].max()\n```\n\nStep3 \u751f\u6210\u53ef\u89c6\u5316\u56fe\u8868\uff0c\u914d\u7f6e\u4e2d\u82f1\u6587\u5b57\u4f53\u652f\u6301\uff0c\u5e76\u8f93\u51fa\u5e26\u6837\u5f0f\u7684 Excel \u7ed3\u679c\u53ca\u4e0b\u8f7d\u94fe\u63a5\u3002\n```python\nimport matplotlib.pyplot as plt\nfrom openpyxl.styles import Font\n\n# 1. \u53ef\u89c6\u5316\u914d\u7f6e\nplt.rcParams['font.sans-serif'] = ['SimHei', 'DejaVu Sans'] # \u652f\u6301\u4e2d\u6587\nplt.rcParams['axes.unicode_minus'] = False\n\nplt.figure(figsize=(10, 6), dpi=100)\ntarget_df['category_col'].value_counts().plot(kind='bar', color='skyblue')\nplt.title(\"\u6570\u636e\u5206\u5e03\u7edf\u8ba1\")\nplt.tight_layout()\nplt.savefig(\"analysis_chart.png\")\n\n# 2. \u6837\u5f0f\u5316\u8f93\u51fa\noutput_path = \"analysis_result.xlsx\"\nwith pd.ExcelWriter(output_path, engine='openpyxl') as writer:\n    target_df.to_excel(writer, index=False, sheet_name='Result')\n    \n    # \u9488\u5bf9\u7279\u5b9a\u5355\u5143\u683c\u6807\u7ea2\u52a0\u7c97\uff08\u5982\u6570\u503c\u5f02\u5e38\u9879\uff09\n    workbook = writer.book\n    worksheet = writer.sheets['Result']\n    red_bold_font = Font(color=\"FF0000\", bold=True)\n    \n    for row in range(2, worksheet.max_row + 1):\n        # \u5047\u8bbe\u7b2c 3 \u5217\u662f\u9700\u8981\u68c0\u67e5\u7684\u6570\u503c\u5217\n        if worksheet.cell(row=row, column=3).value > 100:\n            worksheet.cell(row=row, column=1).font = red_bold_font\n\nprint(f\"\u5206\u6790\u5b8c\u6210\uff0c\u7ed3\u679c\u5df2\u4fdd\u5b58\u81f3: {output_path}\")\n# \u751f\u6210\u4e0b\u8f7d\u94fe\u63a5\uff08\u73af\u5883\u76f8\u5173\uff09\n# print(f\"Download link: [\u70b9\u51fb\u4e0b\u8f7d]({output_path})\")\n```\n","use_cases":["Clean merged cell data and perform regular expression normalization","Cross-sheet verification of numerical total differences","Generate data distribution statistical charts","Styled output results and generate download links"],"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-cleaning\/missing-value-handling\/SKILL.md","source_commit":"07e7ff8c4bdfd7b79e7402fe94af59d2a5a9749b","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-15T08:05:32.000000Z","updated_at":"2026-11-16T05:16:30.000000Z","seo_title":"Excel Smart Cleaning and Analysis Tool","seo_description":"Efficiently process multi-sheet Excel data, achieving cleaning, verification, analysis, and visualization output.","seo_keywords":["Excel data cleaning","multi-sheet verification analysis","data visualization charts","styled Excel output","cross-sheet difference detection"]}}