{"data":{"slug":"github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-cleaning-text-normalization-7e078be3c06c","title":"Text Normalization and Large File Processing","summary":"Clean and standardize text in Excel files, removing abnormal prefixes and extracting pure Chinese characters, then output the cleaned Excel file with a download link.","url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-cleaning-text-normalization-7e078be3c06c","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-cleaning-text-normalization-7e078be3c06c","markdown_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-cleaning-text-normalization-7e078be3c06c.md","download_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-cleaning-text-normalization-7e078be3c06c\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"The skill requires the user to specify the target numeric column and target text column for processing. The output is a cleaned Excel file saved to a specified path with a downloadable link provided.","instructions":"---\nname: text-normalization-and-large-file-processing\ndescription: \"\u5bf9Excel\u6587\u4ef6\u8fdb\u884c\u6587\u672c\u6807\u51c6\u5316\u6e05\u6d17\uff08\u5982\u53bb\u9664\u5f02\u5e38\u524d\u7f00\u3001\u63d0\u53d6\u7eaf\u4e2d\u6587\u5b57\u7b26\u7b49\uff09\uff0c\u5e76\uff0c\u6700\u7ec8\u8f93\u51fa\u6e05\u6d17\u540e\u7684Excel\u6587\u4ef6\u5e76\u63d0\u4f9b\u4e0b\u8f7d\u94fe\u63a5\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\nStep1 \u8bc6\u522b\u5e76\u6e05\u6d17\u5305\u542b\u524d\u7f00\u7b26\u53f7\u7684\u5f02\u5e38\u6570\u503c\u5b57\u6bb5\uff0c\u7edf\u4e00\u8f6c\u6362\u4e3a\u6574\u6570\u7c7b\u578b\uff1b\u540c\u65f6\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6e05\u6d17\u6587\u672c\u5b57\u6bb5\uff0c\u4ec5\u4fdd\u7559 Unicode \u8303\u56f4\u5185\u7684\u4e2d\u6587\u5b57\u7b26\u3002\n```python\nimport re\nimport numpy as np\n\ntarget_numeric_col = '\u9700\u8981\u8f6c\u6570\u5b57\u7684\u6587\u672c\u5217' # \u793a\u4f8b\uff1a'\u83b7\u8d5e'\ntarget_text_col = '\u9700\u8981\u63d0\u53d6\u4e2d\u6587\u7684\u5217' # \u793a\u4f8b\uff1a'\u6536\u8d27\u4eba'\n\n# 1. \u6e05\u6d17\u5305\u542b\u524d\u7f00\u7b26\u53f7\u7684\u6570\u503c\u5b57\u6bb5\nprefix_patterns = ['.', 'I ', '\u25a0 ', '\u4e00 ', '_', '. ']\ndef clean_numeric_with_prefix(value):\n    val_str = str(value).strip()\n    if val_str in ['None', 'nan', '', 'nan']:\n        return np.nan\n    for prefix in prefix_patterns:\n        if val_str.startswith(prefix):\n            val_str = val_str[len(prefix):].strip()\n            break\n    if val_str == '':\n        return np.nan\n    try:\n        return int(val_str)\n    except ValueError:\n        return np.nan\n\n# 2. \u6e05\u6d17\u6587\u672c\u5b57\u6bb5\uff0c\u4ec5\u4fdd\u7559 Unicode \u8303\u56f4\u5185\u7684\u4e2d\u6587\u5b57\u7b26\uff08\\u4e00-\\u9fff\uff09\ndef clean_chinese_name(name):\n    if pd.isna(name):\n        return name\n    s = str(name)\n    chinese_chars = re.findall(r'[\\u4e00-\\u9fff]', s)\n    cleaned = ''.join(chinese_chars)\n    return cleaned if cleaned else ''\n\nif target_numeric_col in df.columns:\n    df[f'{target_numeric_col}_\u6e05\u6d17\u540e'] = df[target_numeric_col].apply(clean_numeric_with_prefix)\n    \nif target_text_col in df.columns:\n    df[f'{target_text_col}_\u6e05\u6d17\u540e'] = df[target_text_col].apply(clean_chinese_name)\n```\n\nStep2 \u5c06\u6e05\u6d17\u540e\u7684\u7ed3\u679c\u4fdd\u5b58\u4e3a Excel \u6587\u4ef6\uff0c\u5728\u62a5\u544a\u4e2d\u63d0\u4f9b\u4e0b\u8f7d\u94fe\u63a5\uff0c\u5e76\u6267\u884c\u5185\u5b58\u6e05\u7406\u4ee5\u5e94\u5bf9\u5927\u6587\u4ef6\u5904\u7406\u65f6\u7684\u5185\u5b58\u538b\u529b\u3002\n```python\noutput_path = '\/mnt\/data\/\u6807\u51c6\u5316\u6e05\u6d17\u7ed3\u679c.xlsx'\n\n# \u4fdd\u5b58\u6e05\u6d17\u7ed3\u679c\ndf.to_excel(output_path, index=False, engine='openpyxl')\nprint(f'\u6e05\u6d17\u7ed3\u679c\u5df2\u4fdd\u5b58\u5230: {output_path}')\n\n# \u751f\u6210\u53ef\u4e0b\u8f7d\u94fe\u63a5\nprint(f'[\u4e0b\u8f7d\u6e05\u6d17\u7ed3\u679c\u8868](sandbox:{output_path})')\n\n# \u5185\u5b58\u6e05\u7406\nif 'df' in locals():\n    del df\n    gc.collect()\n```\n","use_cases":["Cleaning and standardizing text in Excel files for data analysis.","Extracting pure Chinese characters from text fields for linguistic research."],"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\/text-normalization\/SKILL.md","source_commit":"07e7ff8c4bdfd7b79e7402fe94af59d2a5a9749b","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-15T08:13:38.000000Z","updated_at":"2026-11-16T05:16:30.000000Z","seo_title":"Text normalization and Excel file processing","seo_description":"Clean and standardize text in Excel files, removing abnormal prefixes and extracting pure Chinese characters, then output the cleaned Excel file with a download link.","seo_keywords":["Excel text cleaning","Chinese character extraction","Data preprocessing","Text normalization"]}}