{"data":{"slug":"github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-filtering-range-filtering-d16099772439","title":"Excel Conditional Filtering Optimization","summary":"Efficiently filter Excel data based on multi-dimensional numerical conditions and export the results with performance optimization for large datasets.","url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-filtering-range-filtering-d16099772439","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-filtering-range-filtering-d16099772439","markdown_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-filtering-range-filtering-d16099772439.md","download_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-filtering-range-filtering-d16099772439\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"The tool requires the input Excel file to be preprocessed with consistent column headers and numerical data. The output is a new Excel file containing filtered unique records.","instructions":"---\nname: excel-conditional-filtering-optimization\ndescription: \"\u6839\u636e\u591a\u7ef4\u6570\u503c\u6761\u4ef6\u7b5b\u9009 Excel \u6570\u636e\u5e76\u5bfc\u51fa\u7ed3\u679c\uff0c\u652f\u6301\u5927\u89c4\u6a21\u6570\u636e\u7684\u81ea\u52a8\u6027\u80fd\u4f18\u5316\u5904\u7406\u3002\"\n---\n\n# Excel_Conditional_Filtering_Optimization\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\n\nStep1 \u8bfb\u53d6 Excel \u6587\u4ef6\u4e2d\u6240\u6709\u5de5\u4f5c\u8868\u7684\u6570\u636e\uff0c\u7edf\u8ba1\u5404\u8868\u884c\u6570\u5e76\u6c47\u603b\uff0c\u7528\u4e8e\u8bc4\u4f30\u6570\u636e\u89c4\u6a21\u3002\n```python\nimport pandas as pd\n\nfile_path = \"input_data.xlsx\"\n\n# \u8bfb\u53d6\u6240\u6709 sheet\uff0c\u7edf\u8ba1\u884c\u6570\nxls = pd.ExcelFile(file_path)\nprint(\"Sheet names:\", xls.sheet_names)\n\ntotal_rows = 0\nsheet_details = []\nfor sheet in xls.sheet_names:\n    df_temp = pd.read_excel(file_path, sheet_name=sheet)\n    row_count = len(df_temp)\n    sheet_details.append({\"sheet\": sheet, \"rows\": row_count})\n    total_rows += row_count\n\nprint(f\"Sheet details: {sheet_details}\")\nprint(f\"Total rows across all sheets: {total_rows}\")\n```\n\nStep2 \u5bf9\u76ee\u6807\u6570\u636e\u8fdb\u884c\u6e05\u6d17\uff0c\u5904\u7406\u8868\u5934\u504f\u79fb\uff0c\u5e76\u5c06\u5173\u952e\u5217\u8f6c\u6362\u4e3a\u6570\u503c\u7c7b\u578b\u4ee5\u786e\u4fdd\u8ba1\u7b97\u51c6\u786e\u3002\n```python\n# \u8bfb\u53d6\u76ee\u6807\u6570\u636e\u8868\ntarget_sheet = 'Sheet1'\ndf = pd.read_excel(file_path, sheet_name=target_sheet, header=0)\n\n# \u5904\u7406\u53ef\u80fd\u7684\u5b50\u8868\u5934\u6216\u7a7a\u884c\u504f\u79fb\uff08\u793a\u4f8b\uff1a\u8df3\u8fc7\u7b2c\u4e00\u884c\uff09\n# df = df.iloc[1:].reset_index(drop=True)\n\n# \u7edf\u4e00\u8bbe\u7f6e\u5217\u540d\uff08\u6839\u636e\u5b9e\u9645\u4e1a\u52a1\u903b\u8f91\u8c03\u6574\u5360\u4f4d\u7b26\uff09\n# df.columns = ['col_1', 'col_2', 'col_3', 'target_id', 'val_a', 'val_b', 'val_c']\n\n# \u5f3a\u5236\u8f6c\u6362\u6570\u503c\u5217\uff0c\u5904\u7406\u975e\u6570\u503c\u6570\u636e\u4e3a NaN\nnumeric_cols = ['val_a', 'val_b', 'val_c', 'target_id']\nfor col in numeric_cols:\n    if col in df.columns:\n        df[col] = pd.to_numeric(df[col], errors='coerce')\n\n# \u5904\u7406\u5408\u5e76\u5355\u5143\u683c\uff08\u5982\u6709\uff09\n# df = df.ffill()\n```\n\nStep3 \u6267\u884c\u591a\u7ef4\u5ea6\u6761\u4ef6\u7b5b\u9009\u903b\u8f91\uff0c\u63d0\u53d6\u7b26\u5408\u7279\u5b9a\u6570\u503c\u7279\u5f81\u7684\u552f\u4e00\u8bb0\u5f55\u3002\n```python\n# \u7b5b\u9009\u903b\u8f91\uff1a\u4f8b\u5982 val_a, val_b, val_c \u540c\u65f6\u6ee1\u8db3\u7279\u5b9a\u9608\u503c\uff08\u5982\u5747\u4e3a 0\uff09\nmask = (df['val_a'] == 0) & (df['val_b'] == 0) & (df['val_c'] == 0)\nfiltered_df = df[mask][['target_id', 'val_a', 'val_b', 'val_c']]\n\n# \u63d0\u53d6\u552f\u4e00\u7f16\u53f7\u5e76\u53bb\u9664\u7a7a\u503c\nresult = filtered_df.drop_duplicates().dropna(subset=['target_id']).reset_index(drop=True)\n```\n\nStep4 \u5c06\u7b5b\u9009\u540e\u7684\u7ed3\u679c\u4fdd\u5b58\u4e3a\u65b0\u7684 Excel \u6587\u4ef6\uff0c\u5e76\u751f\u6210\u4e0b\u8f7d\u94fe\u63a5\u3002\n```python\noutput_path = \"filtered_analysis_result.xlsx\"\n\n# \u683c\u5f0f\u5316\u8f93\u51fa\u5217\u540d\nresult.columns = ['Target_Index', 'Value_A', 'Value_B', 'Value_C']\n\n# \u5bfc\u51fa\u6587\u4ef6\nresult.to_excel(output_path, index=False)\n\n# \u6253\u5370\u7ed3\u679c\u6458\u8981\u4e0e\u4e0b\u8f7d\u8def\u5f84\nprint(f\"Filtered records count: {len(result)}\")\nprint(f\"Result saved to: {output_path}\")\n```\n","use_cases":["Filtering large Excel datasets based on specific numerical thresholds for data analysis.","Extracting unique records that meet multiple criteria for reporting or further processing."],"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-filtering\/range-filtering\/SKILL.md","source_commit":"07e7ff8c4bdfd7b79e7402fe94af59d2a5a9749b","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-15T08:23:01.000000Z","updated_at":"2026-11-16T05:16:30.000000Z","seo_title":"Excel Conditional Filtering Optimization Tool","seo_description":"Optimize Excel data filtering with multi-dimensional numerical conditions and export results efficiently.","seo_keywords":["Excel data filtering","multi-dimensional condition filtering","large dataset optimization","Excel result export"]}}