بنقرة واحدة
excel-large-file-processing-and-cleaning
读取多 sheet Excel 文件,动态识别目标列进行统计,并使用正则清洗文本字段提取中文字符,最终输出标准化 Excel 文件。
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
读取多 sheet Excel 文件,动态识别目标列进行统计,并使用正则清洗文本字段提取中文字符,最终输出标准化 Excel 文件。
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Base-layer skill for the SenseNova-Skills project, providing low-level APIs for image generation, recognition (VLM), and text optimization (LLM). This skill does not preprocess inputs; it only calls backend services and returns results. This skill is not user-facing and is intended for upper-layer skills only.
用于用户请求深度研究、系统性研究、竞品分析、方案对比、趋势分析或事实核查时。**遇到以下任一情况就主动使用本 skill,不要自行搜几条就回答**:①用户出现触发词:深度研究 / 深度调研 / 深入研究 / 全面研究 / 系统研究 / 调研 / 调查 / 尽调 / 行业研究 / 市场研究 / 竞品分析 / 政策研究 / 技术研究 / 趋势研究 / 事实核查 / 写一份研究报告 / 调研报告 / 深度报告 / research / deep research;②请求需要跨多来源取证、多维度对比、交叉验证才能给出可靠结论;③用户要求产出报告、白皮书、行业分析或尽调文档;④话题涉及最新政策/市场/产品/价格/法规,需要系统核查。明确要求核验来源的单点事实可走 quick;无核验要求的简单常识问答不使用。模糊或宽泛的"研究/了解一下 X"也优先触发。仅不用于:一句话摘要、已给定单一来源的整理、纯文字润色改写。
用于研究任务的最终呈现形式未知时。比较研究报告、学术论文、表格优先报表、决策备忘录或自定义形式,并用权威标准与真实范例支持推荐。
用于搜索中文社交平台。脚本入口覆盖 B站视频、知乎问答和抖音视频;小红书、微博当前没有脚本入口,只能通过 browser-use / 公开网页兜底。
搜索社区、社媒、新闻热点、百科趋势、开发者生态和技术讨论时使用。
用于学术调研、论文精读、相关工作梳理、百科知识查询和引用链追溯。
| name | excel-large-file-processing-and-cleaning |
| description | 读取多 sheet Excel 文件,动态识别目标列进行统计,并使用正则清洗文本字段提取中文字符,最终输出标准化 Excel 文件。 |
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 ''
clean_col = '目标清洗列' # 占位示例,如'收货人'
if clean_col in df.columns:
df[clean_col] = df[clean_col].apply(extract_chinese)
Step2 动态模糊匹配列名,并统计该列中特定值的数量。
# 动态查找包含特定关键字的列
keyword = 'type'
target_val = 'varchar'
target_col = next((col for col in df.columns if keyword in str(col).lower()), None)
total_target_count = 0
details = []
if target_col is not None:
# 忽略大小写和首尾空格进行匹配
mask = df[target_col].astype(str).str.lower().str.strip() == target_val
count = mask.sum()
total_target_count += count
if count > 0:
details.append({
'sheet': target_sheet,
'target_count': count,
'total_rows': len(df)
})
print(f"{'='*50}")
print(f"匹配列 '{target_col}' 中值为 '{target_val}' 的总数: {total_target_count}")
print(f"{'='*50}")
for detail in details:
print(f" {detail['sheet']}: {detail['target_count']} 个匹配项 (共 {detail['total_rows']} 行)")
Step3 将清洗和处理后的数据保存为 Excel,并输出文件大小与下载链接。
output_path = "/mnt/data/cleaned_data_output.xlsx"
df.to_excel(output_path, index=False)
file_size = os.path.getsize(output_path)
print(f"清洗后的数据已保存至: {output_path}")
print(f"文件大小: {file_size} 字节")
# 生成标准下载链接格式
print(f"下载链接: sandbox:{output_path}")