{"data":{"slug":"github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-reading-range-reading-d4fc4545464e","title":"Excel Data Cleaning and Statistical Analysis","summary":"Perform data cleaning, large file optimization, and advanced statistical analysis on Excel files. Supports multi-sheet processing, null value statistics, Parquet conversion, and visualization chart generation.","url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-reading-range-reading-d4fc4545464e","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-reading-range-reading-d4fc4545464e","markdown_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-reading-range-reading-d4fc4545464e.md","download_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-reading-range-reading-d4fc4545464e\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"The tool requires Python and pandas for execution. It processes Excel files with column names containing spaces, calculates null value statistics, and generates linear regression analysis charts.","instructions":"---\nname: range-reading-and-large-file-analysis\ndescription: \"\u8bfb\u53d6\u591a Sheet Excel \u6587\u4ef6\uff0c\u6839\u636e\u6570\u636e\u91cf\u52a8\u6001\u9009\u62e9\u5904\u7406\u7b56\u7565\uff0c\u652f\u6301\u7279\u5b9a\u533a\u57df\u6570\u636e\u63d0\u53d6\u3001\u5927\u6587\u4ef6 Parquet \u8f6c\u6362\u3001\u7edf\u8ba1\u5206\u6790\u53ca\u53ef\u89c6\u5316\u56fe\u8868\u751f\u6210\u3002\"\n---\n\n> **Note**: This sub-skill covers one step of the Excel analysis workflow. For the full pipeline (file reading, row counting, large-file optimization, export), see the parent workflow SKILL.md.\n\nStep1 \u9488\u5bf9\u7279\u5b9a Sheet \u8fdb\u884c\u6570\u636e\u6e05\u6d17\u4e0e\u7a7a\u503c\u7edf\u8ba1\u3002\u652f\u6301\u5904\u7406\u5e26\u7a7a\u683c\u7684\u5217\u540d\uff0c\u5e76\u8ba1\u7b97\u5173\u952e\u6307\u6807\u7684\u7f3a\u5931\u7387\u3002\n```python\ntarget_sheet = \"Sheet2\"\ntarget_col = \"\u662f\u5426\u901a\u8fc7\"  # \u793a\u4f8b\u5217\u540d\uff0c\u5b9e\u9645\u6839\u636e\u9700\u6c42\u66ff\u6362\n\n# \u8bfb\u53d6\u6307\u5b9a Sheet\ndf_target = pd.read_excel(file_path, sheet_name=target_sheet)\n\n# \u6e05\u6d17\u5217\u540d\uff1a\u53bb\u9664\u9996\u5c3e\u7a7a\u683c\ndf_target.columns = [str(col).strip() for col in df_target.columns]\n\nif target_col in df_target.columns:\n    null_count = df_target[target_col].isna().sum()\n    print(f\"'{target_col}' \u5217\u4e3a\u7a7a\u7684\u6570\u91cf: {null_count}\")\n    \n    # \u7edf\u8ba1\u5360\u6bd4\n    stats = df_target[target_col].value_counts(dropna=False)\n    print(\"\u5206\u7c7b\u7edf\u8ba1\u7ed3\u679c\uff1a\\n\", stats)\nelse:\n    print(f\"\u672a\u627e\u5230\u76ee\u6807\u5217: {target_col}\")\n```\n\nStep2 \u5927\u6587\u4ef6\u4f18\u5316\u5904\u7406\uff1a\u5c06 Excel \u8f6c\u6362\u4e3a Parquet \u683c\u5f0f\u4ee5\u63d0\u5347\u540e\u7eed\u8bfb\u53d6\u901f\u5ea6\uff0c\u5e76\u63d0\u53d6\u7279\u5b9a\u884c\/\u5217\u8303\u56f4\u7684\u6570\u636e\u8fdb\u884c\u7ed3\u6784\u5316\u8f6c\u6362\u3002\n```python\nimport numpy as np\n\noutput_dir = \"output_results\"\nos.makedirs(output_dir, exist_ok=True)\n\nif is_large_file:\n    # \u8f6c\u6362\u4e3a Parquet \u683c\u5f0f\n    parquet_path = os.path.join(output_dir, \"temp_data.parquet\")\n    # \u6ce8\u610f\uff1a\u5927\u6587\u4ef6\u8bfb\u53d6\u5efa\u8bae\u5206\u5757\u6216\u6307\u5b9a\u5173\u952e\u5217\n    df_full = pd.read_excel(file_path)\n    df_full.to_parquet(parquet_path, engine='pyarrow', index=False)\n    df = pd.read_parquet(parquet_path)\nelse:\n    df = pd.read_excel(file_path)\n\n# \u63d0\u53d6\u7279\u5b9a\u533a\u57df\u6570\u636e\uff08\u4f8b\u5982\uff1a\u884c 40-50\uff0c\u7279\u5b9a\u4e24\u5217\uff09\n# \u6a21\u62df\u4ece\u975e\u89c4\u8303\u8868\u683c\u4e2d\u63d0\u53d6\u6570\u503c\u5bf9\ndata_rows = []\nx_col_idx, y_col_idx = 0, 1 # \u5047\u8bbe\u76ee\u6807\u6570\u636e\u5728\u7b2c0\u5217\u548c\u7b2c1\u5217\n\nfor i in range(40, min(50, len(df))):\n    row = df.iloc[i]\n    try:\n        # \u6e05\u6d17\u5b57\u7b26\u4e32\u5e76\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\n        val_x = float(str(row.iloc[x_col_idx]).replace(' ', ''))\n        val_y = float(str(row.iloc[y_col_idx]).replace(' ', ''))\n        if pd.notna(val_x) and pd.notna(val_y):\n            data_rows.append((val_x, val_y))\n    except (ValueError, TypeError):\n        continue\n\nanalysis_df = pd.DataFrame(data_rows, columns=['target_x', 'target_y'])\n```\n\nStep3 \u6267\u884c\u9ad8\u7ea7\u7edf\u8ba1\u5206\u6790\u4e0e\u53ef\u89c6\u5316\u3002\u5305\u542b\u7ebf\u6027\u56de\u5f52\u62df\u5408\u3001\u4e2d\u82f1\u6587\u5b57\u4f53\u914d\u7f6e\u3001\u9ad8\u5206\u8fa8\u7387\u56fe\u8868\u4fdd\u5b58\u53ca\u4e0b\u8f7d\u94fe\u63a5\u751f\u6210\u3002\n```python\nimport matplotlib.pyplot as plt\n\n# \u914d\u7f6e\u4e2d\u6587\u5b57\u4f53\uff08\u517c\u5bb9\u4e0d\u540c\u73af\u5883\uff09\nplt.rcParams['font.sans-serif'] = ['SimHei', 'DejaVu Sans']\nplt.rcParams['axes.unicode_minus'] = False\n\nif not analysis_df.empty:\n    x = analysis_df['target_x'].values\n    y = analysis_df['target_y'].values\n    \n    # 1. \u7ebf\u6027\u62df\u5408\n    coeffs = np.polyfit(x, y, 1)\n    poly_func = np.poly1d(coeffs)\n    trend_line = poly_func(x)\n    \n    # 2. \u7ed8\u56fe\u7f8e\u5316\n    plt.figure(figsize=(10, 6), dpi=300)\n    plt.scatter(x, y, color='#1f77b4', s=60, label='\u539f\u59cb\u6570\u636e\u70b9', alpha=0.7)\n    plt.plot(x, trend_line, color='#d62728', lw=2, label=f'\u8d8b\u52bf\u7ebf: y={coeffs[0]:.4f}x+{coeffs[1]:.4f}')\n    \n    plt.title(\"\u6570\u636e\u5206\u5e03\u4e0e\u7ebf\u6027\u56de\u5f52\u5206\u6790\", fontsize=14, pad=20)\n    plt.xlabel(\"\u7ef4\u5ea6 X\", fontsize=12)\n    plt.ylabel(\"\u7ef4\u5ea6 Y\", fontsize=12)\n    plt.grid(True, linestyle='--', alpha=0.5)\n    plt.legend()\n    \n    chart_path = os.path.join(output_dir, \"analysis_chart.png\")\n    plt.savefig(chart_path, bbox_inches='tight')\n    plt.close()\n    \n    # 3. \u7ed3\u679c\u5bfc\u51fa\n    result_path = os.path.join(output_dir, \"analysis_results.csv\")\n    analysis_df['trend_prediction'] = trend_line\n    analysis_df.to_csv(result_path, index=False, encoding='utf-8-sig')\n    \n    # 4. \u8f93\u51fa\u4e0b\u8f7d\u94fe\u63a5\n    print(f\"\u5206\u6790\u56fe\u8868\u5df2\u4fdd\u5b58: sandbox:{chart_path}\")\n    print(f\"\u7ed3\u6784\u5316\u6570\u636e\u5df2\u4fdd\u5b58: sandbox:{result_path}\")\n    print(f\"\u62df\u5408\u65b9\u7a0b: y = {coeffs[0]:.4f}x + {coeffs[1]:.4f}\")\nelse:\n    print(\"\u672a\u63d0\u53d6\u5230\u6709\u6548\u6570\u503c\u6570\u636e\uff0c\u8df3\u8fc7\u53ef\u89c6\u5316\u6b65\u9aa4\")\n```\n","use_cases":["Process Excel files with column names containing spaces and perform null value statistics","Convert large files to Parquet format to improve read speed","Extract numerical pairs from non-standard tables and generate linear regression analysis charts"],"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-reading\/range-reading\/SKILL.md","source_commit":"07e7ff8c4bdfd7b79e7402fe94af59d2a5a9749b","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-15T09:25:54.000000Z","updated_at":"2026-11-16T05:16:30.000000Z","seo_title":"Excel Data Cleaning and Statistical Analysis Tool","seo_description":"Efficiently process Excel files with data cleaning, null value statistics, Parquet conversion, and visualization analysis, ideal for data research and statistical tasks.","seo_keywords":["Excel Data Cleaning","Parquet Conversion","Linear Regression Analysis","Null Value Statistics","Data Visualization"]}}