condition-filtering-and-large-file-optimization
Installation
SKILL.md
condition_filtering
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.
Step1 执行多维度数据清洗与条件筛选,包含列名自动识别、RGB 颜色过滤、前缀匹配及正则提取。
# 1. 自动识别同义列名并筛选非空值
target_cols = ['域名', '缩写', 'code', 'domain']
for col in target_cols:
if col in df.columns:
df = df[df[col].notna()]
break
# 2. 基于数值通道的精确筛选(如 RGB 颜色过滤)
# 技巧:多条件组合筛选时使用 & 符号
if all(c in df.columns for c in ['Red', 'Green', 'Blue']):
df = df[(df['Red'] == 0) & (df['Green'] == 0) & (df['Blue'] == 0)]