Install any skill in seconds. Free to start, no credit card required.
Get Started Free →根据Excel总行数自动切换Parquet加速读取,计算特定维度的时间序列平均值,并使用openpyxl输出带有条件格式(如低于均值标绿)和自定义样式的分析报告。
.claude/skills/opensensenova-large-file-conditional-formatting/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -22% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -2% | 0% |
| case-08 | ✗→✓ | ▲ Improved | -45% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 0% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 42% | 0% |
> 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 的行数,汇总后打印总行数,用于判断是否需要大文件加速。
pythonimport pandas as pd import openpyxl file_path = "input_data.xlsx" # 获取所有sheet名称 wb = openpyxl.load_workbook(file_path, read_only=True) sheet_names = wb.sheetnames print("Sheet列表:", sheet_names) print("Sheet数量:", len(sheet_names)) # 统计每个sheet的行数 total_rows = 0 for name in sheet_names: df_temp = pd.read_excel(file_path, sheet_name=name, header=None) rows = len(df_temp) total_rows += rows print(f"Sheet '{name}': {rows} 行") print(f"\n总行数 = {total_rows}")
Step2 提取目标实体的时间序列数据,计算平均值,并构建包含比较结果的结构化 DataFrame。
pythontarget_entity = 'Target_Entity' # 占位示例,如 'US' # 提取目标行数据 (假设第0列为实体名称) target_row = df[df[0] == target_entity] # 提取时间标签和对应数值 (假设第6行为表头,1:10列为数据) time_labels = df.iloc[6, 1:10].tolist() target_values = target_row.iloc[0, 1:10].tolist() target_values_numeric = [float(v) for v in target_values] # 计算平均值 avg_value = sum(target_values_numeric) / len(target_values_numeric) # 构建结果 DataFrame result_data = { '时间维度': time_labels, '指标数值': target_values_numeric, '是否低于平均值': [v < avg_value for v in target_values_numeric] } result_df = pd.DataFrame(result_data)
Step3 使用 openpyxl 将分析结果保存为 Excel 文件,应用精细的样式控制(加粗标题、边框、居中对齐),并对低于平均值的行进行条件格式填充(标绿)。
pythonfrom openpyxl import Workbook from openpyxl.styles import PatternFill, Font, Alignment, Border, Side wb = Workbook() ws = wb.active ws.title = "指标分析报告" # 定义样式 green_fill = PatternFill(start_color="92D050", end_color="92D050", fill_type="solid") header_fill = PatternFill(start_color="4472C4", end_color="4472C4", fill_type="solid") header_font = Font(bold=True, color="FFFFFF") thin_border = Border( left=Side(style='thin'), right=Side(style='thin'), top=Side(style='thin'), bottom=Side(style='thin') ) # 设置主标题 ws.merge_cells('A1:D1') ws['A1'] = f"目标实体指标分析 - 平均值: {avg_value:.2f}" ws['A1'].font = Font(bold=True, size=14) ws['A1'].alignment = Alignment(horizontal='center') # 设置表头 headers = ['时间维度', '指标数值', '与平均值比较', '是否标绿'] for col, header in enumerate(headers, 1): cell = ws.cell(row=3, column=col, value=header) cell.fill = header_fill cell.font = header_font cell.alignment = Alignment(horizontal='center') cell.border = thin_border # 写入数据并应用条件格式 for i, row_data in result_df.iterrows(): row_num = i + 4 time_label = row_data['时间维度'] value = row_data['指标数值'] below_avg = row_data['是否低于平均值'] # 写入各列数据 ws.cell(row=row_num, column=1, value=time_label).alignment = Alignment(horizontal='center') ws.cell(row=row_num, column=2, value=value).alignment = Alignment(horizontal='center') diff = value - avg_value ws.cell(row=row_num, column=3, value=f"{diff:+.2f}").alignment = Alignment(horizontal='center') ws.cell(row=row_num, column=4, value="是" if below_avg else "否").alignment = Alignment(horizontal='center') # 添加边框并根据条件标绿整行 for col in range(1, 5): cell = ws.cell(row=row_num, column=col) cell.border = thin_border if below_avg: cell.fill = green_fill # 调整列宽 ws.column_dimensions['A'].width = 15 ws.column_dimensions['B'].width = 20 ws.column_dimensions['C'].width = 18 ws.column_dimensions['D'].width = 12 output_path = "output_report.xlsx" wb.save(output_path) print(f"分析报告已保存至: {output_path}")
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 20,057 | 14,999 | -25% | 1 | 1 | 0% | 4,714 | 3,694 | -22% | 0 | 0 | — |
case-02 | fail→pass | 18,334 | 14,466 | -21% | 1 | 1 | 0% | 4,179 | 4,098 | -2% | 0 | 0 | — |
case-03 | fail→fail | 18,918 | 10,990 | -42% | 1 | 1 | 0% | 4,068 | 3,816 | -6% | 0 | 0 | — |
case-04 | pass→pass | 14,184 | 14,754 | +4% | 1 | 1 | 0% | 2,864 | 4,222 | +47% | 0 | 0 | — |
case-05 | pass→pass | 6,879 | 4,488 | -35% | 1 | 1 | 0% | 1,406 | 2,202 | +57% | 0 | 0 | — |
case-06 | pass→pass | 19,394 | 10,691 | -45% | 1 | 1 | 0% | 3,071 | 3,558 | +16% | 0 | 0 | — |
case-07 | pass→pass | 10,589 | 4,516 | -57% | 1 | 1 | 0% | 1,836 | 2,315 | +26% | 0 | 0 | — |
case-08 | fail→pass | 26,886 | 9,775 | -64% | 1 | 1 | 0% | 6,192 | 3,427 | -45% | 0 | 0 | — |
case-09 | pass→pass | 7,963 | 8,040 | +1% | 1 | 1 | 0% | 1,734 | 2,688 | +55% | 0 | 0 | — |
case-10 | fail→fail | 9,359 | 7,368 | -21% | 1 | 1 | 0% | 1,529 | 2,978 | +95% | 0 | 0 | — |
case-11 | fail→fail | 10,741 | 9,532 | -11% | 1 | 1 | 0% | 2,067 | 3,054 | +48% | 0 | 0 | — |
case-12 | fail→fail | 11,889 | 4,394 | -63% | 1 | 1 | 0% | 2,531 | 2,248 | -11% | 0 | 0 | — |
case-13 | pass→pass | 15,721 | 7,483 | -52% | 1 | 1 | 0% | 2,483 | 2,920 | +18% | 0 | 0 | — |
case-14 | fail→pass | 11,415 | 5,696 | -50% | 1 | 1 | 0% | 2,335 | 2,337 | +0% | 0 | 0 | — |
case-15 | pass→fail | 11,422 | 8,465 | -26% | 1 | 1 | 0% | 2,241 | 3,148 | +40% | 0 | 0 | — |
case-16 | fail→fail | 21,344 | 6,678 | -69% | 1 | 1 | 0% | 3,441 | 2,764 | -20% | 0 | 0 | — |
case-17 | fail→pass | 9,398 | 6,271 | -33% | 1 | 1 | 0% | 1,774 | 2,513 | +42% | 0 | 0 | — |
case-18 | pass→pass | 10,863 | 5,554 | -49% | 1 | 1 | 0% | 2,272 | 2,508 | +10% | 0 | 0 | — |
case-19 | pass→pass | 7,950 | 8,453 | +6% | 1 | 1 | 0% | 1,226 | 2,693 | +120% | 0 | 0 | — |
case-20 | fail→fail | 17,241 | 10,343 | -40% | 1 | 1 | 0% | 3,890 | 3,660 | -6% | 0 | 0 | — |
case-21 | fail→pass | 12,151 | 6,711 | -45% | 1 | 1 | 0% | 2,405 | 2,585 | +7% | 0 | 0 | — |
case-22 | pass→pass | 9,987 | 4,246 | -57% | 1 | 1 | 0% | 1,625 | 2,038 | +25% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +23 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.