excel-large-file-processing-and-cleaning
Installation
SKILL.md
Skill Steps
This sub-skill covers one capability of the Excel workflow. For reading/counting/Parquet optimization, see the parent workflow SKILL.md.
Step1 文本字段清洗,使用正则表达式提取纯中文字符(过滤数字、特殊符号等)。
import re
def extract_chinese(text):
if pd.isna(text):
return text
# 仅保留 Unicode 中文字符范围
chinese_chars = re.findall(r'[一-龥]', str(text))
cleaned = ''.join(chinese_chars)
return cleaned if cleaned else ''