/range-reading
读取多 Sheet Excel 文件,根据数据量动态选择处理策略,支持特定区域数据提取、大文件 Parquet 转换、统计分析及可视化图表生成。
$ npx -y skills add OpenSenseNova/SenseNova-Skills --skill range-reading --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/range-reading
Context preview
The summary Claude sees to decide when to auto-load this skill.
读取多 Sheet Excel 文件,根据数据量动态选择处理策略,支持特定区域数据提取、大文件 Parquet 转换、统计分析及可视化图表生成。
SKILL.md
range-reading.SKILL.mdname: range-reading-and-large-file-analysis
description: "读取多 Sheet Excel 文件,根据数据量动态选择处理策略,支持特定区域数据提取、大文件 Parquet 转换、统计分析及可视化图表生成。"
> **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 针对特定 Sheet 进行数据清洗与空值统计。支持处理带空格的列名,并计算关键指标的缺失率。
target_sheet = "Sheet2"
target_col = "是否通过" # 示例列名,实际根据需求替换
# 读取指定 Sheet
df_target = pd.read_excel(file_path, sheet_name=target_sheet)
# 清洗列名:去除首尾空格
df_target.columns = [str(col).strip() for col in df_target.columns]
if target_col in df_target.columns:
null_count = df_target[target_col].isna().sum()
print(f"'{target_col}' 列为空的数量: {null_count}")
# 统计占比
stats = df_target[target_col].value_counts(dropna=False)
print("分类统计结果:\n", stats)
else:
print(f"未找到目标列: {target_col}")Step2 大文件优化处理:将 Excel 转换为 Parquet 格式以提升后续读取速度,并提取特定行/列范围的数据进行结构化转换。
import numpy as np
output_dir = "output_results"
os.makedirs(output_dir, exist_ok=True)
if is_large_file:
# 转换为 Parquet 格式
parquet_path = os.path.join(output_dir, "temp_data.parquet")
# 注意:大文件读取建议分块或指定关键列
df_full = pd.read_excel(file_path)
df_full.to_parquet(parquet_path, engine='pyarrow', index=False)
df = pd.read_parquet(parquet_path)
else:
df = pd.read_excel(file_path)
# 提取特定区域数据(例如:行 40-50,特定两列)
# 模拟从非规范表格中提取数值对
data_rows = []
x_col_idx, y_col_idx = 0, 1 # 假设目标数据在第0列和第1列
for i in range(40, min(50, len(df))):
row = df.iloc[i]
try:
# 清洗字符串并转换为浮点数
val_x = float(str(row.iloc[x_col_idx]).replace(' ', ''))
val_y = float(str(row.iloc[y_col_idx]).replace(' ', ''))
if pd.notna(val_x) and pd.notna(val_y):
data_rows.append((val_x, val_y))
except (ValueError, TypeError):
continue
analysis_df = pd.DataFrame(data_rows, columns=['target_x', 'target_y'])Step3 执行高级统计分析与可视化。包含线性回归拟合、中英文字体配置、高分辨率图表保存及下载链接生成。
import matplotlib.pyplot as plt
# 配置中文字体(兼容不同环境)
plt.rcParams['font.sans-serif'] = ['SimHei', 'DejaVu Sans']
plt.rcParams['axes.unicode_minus'] = False
if not analysis_df.empty:
x = analysis_df['target_x'].values
y = analysis_df['target_y'].values
# 1. 线性拟合
coeffs = np.polyfit(x, y, 1)
poly_func = np.poly1d(coeffs)
trend_line = poly_func(x)
# 2. 绘图美化
plt.figure(figsize=(10, 6), dpi=300)
plt.scatter(x, y, color='#1f77b4', s=60, label='原始数据点', alpha=0.7)
plt.plot(x, trend_line, color='#d62728', lw=2, label=f'趋势线: y={coeffs[0]:.4f}x+{coeffs[1]:.4f}')
plt.title("数据分布与线性回归分析", fontsize=14, pad=20)
plt.xlabel("维度 X", fontsize=12)
plt.ylabel("维度 Y", fontsize=12)
plt.grid(True, linestyle='--', alpha=0.5)
plt.legend()
chart_path = os.path.join(output_dir, "analysis_chart.png")
plt.savefig(chart_path, bbox_inches='tight')
plt.close()
# 3. 结果导出
result_path = os.path.join(output_dir, "analysis_results.csv")
analysis_df['trend_prediction'] = trend_line
analysis_df.to_csv(result_path, index=False, encoding='utf-8-sig')
# 4. 输出下载链接
print(f"分析图表已保存: sandbox:{chart_path}")
print(f"结构化数据已保存: sandbox:{result_path}")
print(f"拟合方程: y = {coeffs[0]:.4f}x + {coeffs[1]:.4f}")
else:
print("未提取到有效数值数据,跳过可视化步骤")Read more
name: range-reading-and-large-file-analysis description: "读取多 Sheet Excel 文件,根据数据量动态选择处理策略,支持特定区域数据提取、大文件 Parquet 转换、统计分析及可视化图表生成。"
> **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 针对特定 Sheet 进行数据清洗与空值统计。支持处理带空格的列名,并计算关键指标的缺失率。
target_sheet = "Sheet2"
target_col = "是否通过" # 示例列名,实际根据需求替换
# 读取指定 Sheet
df_target = pd.read_excel(file_path, sheet_name=target_sheet)
# 清洗列名:去除首尾空格
df_target.columns = [str(col).strip() for col in df_target.columns]
if target_col in df_target.columns:
null_count = df_target[target_col].isna().sum()
print(f"'{target_col}' 列为空的数量: {null_count}")
# 统计占比
stats = df_target[target_col].value_counts(dropna=False)
print("分类统计结果:\n", stats)
else:
print(f"未找到目标列: {target_col}")Step2 大文件优化处理:将 Excel 转换为 Parquet 格式以提升后续读取速度,并提取特定行/列范围的数据进行结构化转换。
import numpy as np
output_dir = "output_results"
os.makedirs(output_dir, exist_ok=True)
if is_large_file:
# 转换为 Parquet 格式
parquet_path = os.path.join(output_dir, "temp_data.parquet")
# 注意:大文件读取建议分块或指定关键列
df_full = pd.read_excel(file_path)
df_full.to_parquet(parquet_path, engine='pyarrow', index=False)
df = pd.read_parquet(parquet_path)
else:
df = pd.read_excel(file_path)
# 提取特定区域数据(例如:行 40-50,特定两列)
# 模拟从非规范表格中提取数值对
data_rows = []
x_col_idx, y_col_idx = 0, 1 # 假设目标数据在第0列和第1列
for i in range(40, min(50, len(df))):
row = df.iloc[i]
try:
# 清洗字符串并转换为浮点数
val_x = float(str(row.iloc[x_col_idx]).replace(' ', ''))
val_y = float(str(row.iloc[y_col_idx]).replace(' ', ''))
if pd.notna(val_x) and pd.notna(val_y):
data_rows.append((val_x, val_y))
except (ValueError, TypeError):
continue
analysis_df = pd.DataFrame(data_rows, columns=['target_x', 'target_y'])Step3 执行高级统计分析与可视化。包含线性回归拟合、中英文字体配置、高分辨率图表保存及下载链接生成。
import matplotlib.pyplot as plt
# 配置中文字体(兼容不同环境)
plt.rcParams['font.sans-serif'] = ['SimHei', 'DejaVu Sans']
plt.rcParams['axes.unicode_minus'] = False
if not analysis_df.empty:
x = analysis_df['target_x'].values
y = analysis_df['target_y'].values
# 1. 线性拟合
coeffs = np.polyfit(x, y, 1)
poly_func = np.poly1d(coeffs)
trend_line = poly_func(x)
# 2. 绘图美化
plt.figure(figsize=(10, 6), dpi=300)
plt.scatter(x, y, color='#1f77b4', s=60, label='原始数据点', alpha=0.7)
plt.plot(x, trend_line, color='#d62728', lw=2, label=f'趋势线: y={coeffs[0]:.4f}x+{coeffs[1]:.4f}')
plt.title("数据分布与线性回归分析", fontsize=14, pad=20)
plt.xlabel("维度 X", fontsize=12)
plt.ylabel("维度 Y", fontsize=12)
plt.grid(True, linestyle='--', alpha=0.5)
plt.legend()
chart_path = os.path.join(output_dir, "analysis_chart.png")
plt.savefig(chart_path, bbox_inches='tight')
plt.close()
# 3. 结果导出
result_path = os.path.join(output_dir, "analysis_results.csv")
analysis_df['trend_prediction'] = trend_line
analysis_df.to_csv(result_path, index=False, encoding='utf-8-sig')
# 4. 输出下载链接
print(f"分析图表已保存: sandbox:{chart_path}")
print(f"结构化数据已保存: sandbox:{result_path}")
print(f"拟合方程: y = {coeffs[0]:.4f}x + {coeffs[1]:.4f}")
else:
print("未提取到有效数值数据,跳过可视化步骤")The SenseNova model family plugs directly into agent runtimes such as OpenClaw and hermes-agent, with the skills in this repository extending the models with concrete, end-to-end office capabilities.
Repo: OpenSenseNova/SenseNova-Skills
Other skills on sensenova-skills.
- /sn-da-excel-workflow
Excel 数据分析多步编排器。覆盖:(1) 读取多 Sheet Excel 文件并统计行数,(2) 大文件检测(≥10k 行自动 Parquet 优化),(3) 数据清洗(缺失值、文本标准化、无效字符),(4) 条件筛选与分类提取,(5) 跨 Sheet 统计聚合,(6) 导出 Excel/CSV 并提供下载链接。覆盖从数据读取到报告生成全流程,按步骤编排 capability 子 skill。**遇到以下任一情况就主动使用本 skill,不要自行写几行 pandas 就回答**:①用户出现触发词:Excel 分析 / 表格分析 / 数据分析 /
Open skill - /category-coloring
当Excel文件总行数超过1万行时,通过转换为Parquet格式提升读取性能,提取目标指标并计算最大值,最后将结果输出为Excel并对特定行进行高亮标注。
Open skill - /duplicate-value-coloring
对比Excel多表中的特定系数并对异常值进行颜色标记。
Open skill - /outlier-coloring
识别 Excel 中的超限数值与错误单元格并进行高亮标注。
Open skill - /threshold-cell-coloring
根据Excel总行数自动切换Parquet加速读取,计算特定维度的时间序列平均值,并使用openpyxl输出带有条件格式(如低于均值标绿)和自定义样式的分析报告。
Open skill - /top-value-coloring
根据数据规模动态选择处理策略,对多表数据进行合并、统计筛选,并利用 openpyxl 实现关键指标的自动化样式高亮与格式化导出。
Open skill

