Install any skill in seconds. Free to start, no credit card required.
Get Started Free →提取结构化数据并进行特征清洗与聚类分析,生成包含趋势对比、分布特征与参数敏感性的多维度综合可视化图表,适用于各类趋势预测与多维对比场景。
.claude/skills/opensensenova-line-chart-visualization/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-07 | ✗→✓ | ▲ Improved | 110% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 52% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 62% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 66% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 119% | 0% |
Step1 数据加载与预处理(支持大文件Parquet转换与动态表头识别)。
pythonimport pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.cluster import KMeans from sklearn.preprocessing import StandardScaler import os import re # 设置中英文字体与图表美化 plt.rcParams['font.sans-serif'] = ['SimHei', 'WenQuanYi Zen Hei', 'DejaVu Sans'] plt.rcParams['axes.unicode_minus'] = False file_path = 'input_data.xlsx' # 处理大型Excel文件:统计总行数,若≥1万则转换为Parquet格式提升效率 xls = pd.ExcelFile(file_path) total_rows = sum(pd.read_excel(xls, sheet_name=s, header=None).shape[0] for s in xls.sheet_names) if total_rows >= 10000: parquet_path = "temp_converted_file.parquet" with pd.ExcelWriter(parquet_path, engine='pyarrow') as writer: for sheet in xls.sheet_names: df_sheet = pd.read_excel(xls, sheet_name=sheet, header=None) df_sheet.to_excel(writer, sheet_name=sheet, index=False, header=False) df = pd.read_excel(parquet_path, sheet_name='Sheet1', header=None) else: df = pd.read_excel(file_path, sheet_name='Sheet1', header=None) # 动态识别表头并提取数据 header_row_idx = None target_cols = ['group_col', 'value_col1', 'value_col2'] # 占位示例列名 for idx, row in df.iterrows(): row_vals = row.astype(str).tolist() if all(col in row_vals for col in target_cols): header_row_idx = idx break if header_row_idx is not None: df.columns = df.iloc[header_row_idx].tolist() df_clean = df.iloc[header_row_idx + 1:].reset_index(drop=True) else: df_clean = df.copy()
Step2 数据清洗与特征工程(包含正则提取、缺失值处理与合并单元格还原)。
python# 合并单元格处理 (ffill + 遍历还原) if 'group_col' in df_clean.columns: df_clean['group_col'] = df_clean['group_col'].ffill() # 数据清洗正则表达式:提取数值 if 'value_col1' in df_clean.columns: df_clean['value_col1'] = df_clean['value_col1'].astype(str).str.replace(r'[^\d.]', '', regex=True) df_clean['value_col1'] = pd.to_numeric(df_clean['value_col1'], errors='coerce') df_clean = df_clean.dropna(subset=['value_col1']).reset_index(drop=True) # 分类映射函数骨架 def map_category(val): if pd.isna(val): return 'Unknown' if val > 100: return 'High' # 占位示例 elif val > 50: return 'Medium' return 'Low' if 'value_col1' in df_clean.columns: df_clean['level'] = df_clean['value_col1'].apply(map_category) # 多维度评分/分级算法结构 def calculate_score(row): score = 0 if pd.notna(row.get('value_col1')) and float(row['value_col1']) > 50: # 占位示例 score += 50 if pd.notna(row.get('value_col2')) and float(row['value_col2']) < 10: # 占位示例 score += 50 return score df_clean['comprehensive_score'] = df_clean.apply(calculate_score, axis=1)
Step3 聚类分析与交叉统计(包含标准化、KMeans与多维度交叉分析)。
pythonnumeric_cols = ['value_col1', 'comprehensive_score'] existing_num_cols = [c for c in numeric_cols if c in df_clean.columns] if existing_num_cols: # 数值特征标准化 scaler = StandardScaler() numeric_scaled = scaler.fit_transform(df_clean[existing_num_cols].fillna(0)) # 聚类分析识别潜在数据群组结构 kmeans = KMeans(n_clusters=3, random_state=42) df_clean['cluster_label'] = kmeans.fit_predict(numeric_scaled) # value_counts + 占比计算 if 'level' in df_clean.columns: level_counts = df_clean['level'].value_counts() level_ratio = df_clean['level'].value_counts(normalize=True) * 100 summary_df = pd.DataFrame({'频次': level_counts, '占比(%)': level_ratio.round(2)}) summary_df.loc['总计'] = summary_df.sum() print("分类统计汇总:\n", summary_df) # 交叉分析 crosstab/pivot if 'cluster_label' in df_clean.columns and 'level' in df_clean.columns: cross_tb = pd.crosstab(df_clean['cluster_label'], df_clean['level'], margins=True, margins_name='总计') print("\n聚类与等级交叉分析:\n", cross_tb)
Step4 多维度可视化与结果输出(包含趋势、分布、占比与敏感性分析图表)。
python# 创建多维度综合可视化图表 fig, axes = plt.subplots(2, 2, figsize=(16, 12), dpi=150) fig.suptitle('综合数据分析图表', fontsize=16) group_col = 'group_col' if 'group_col' in df_clean.columns else df_clean.columns[0] # 1. 趋势对比折线图 if 'value_col1' in df_clean.columns: axes[0, 0].plot(df_clean[group_col].astype(str).str[:10], df_clean['value_col1'], marker='o', label='指标1', color='#1f77b4') if 'comprehensive_score' in df_clean.columns: axes[0, 0].plot(df_clean[group_col].astype(str).str[:10], df_clean['comprehensive_score'], marker='s', label='综合评分', color='#ff7f0e') axes[0, 0].set_title('多指标趋势对比') axes[0, 0].set_xlabel('分组维度') axes[0, 0].set_ylabel('数值') axes[0, 0].legend(loc='upper right') axes[0, 0].grid(True, alpha=0.3) axes[0, 0].tick_params(axis='x', rotation=45) # 2. 分布特征直方图 if 'value_col1' in df_clean.columns: axes[0, 1].hist(df_clean['value_col1'].dropna(), bins=15, alpha=0.7, color='skyblue', edgecolor='black') axes[0, 1].set_title('数值分布特征') axes[0, 1].set_xlabel('数值区间') axes[0, 1].set_ylabel('频次') axes[0, 1].grid(True, alpha=0.3) # 3. 市场份额/占比饼图 if 'level' in df_clean.columns: level_counts = df_clean['level'].value_counts() colors_pie = plt.cm.Set3(np.linspace(0, 1, len(level_counts))) axes[1, 0].pie(level_counts, labels=level_counts.index, autopct='%1.1f%%', colors=colors_pie, startangle=90) axes[1, 0].set_title('分类占比分布') # 4. 参数敏感性分析/聚类结果散点图 if 'cluster_label' in df_clean.columns and 'value_col1' in df_clean.columns: sns.scatterplot(data=df_clean, x=group_col, y='value_col1', hue='cluster_label', ax=axes[1, 1], palette='Set1', s=80) axes[1, 1].set_title('聚类分组散点图') axes[1, 1].tick_params(axis='x', rotation=45) axes[1, 1].grid(True, alpha=0.3) plt.tight_layout(rect=[0, 0.03, 1, 0.95]) # 保存图表与清洗后的数据 chart_path = "output_chart.png" output_path = "output_table.xlsx" plt.savefig(chart_path, dpi=300, bbox_inches='tight') plt.close() df_clean.to_excel(output_path, index=False) # 生成下载链接 print(f"分析完成。") print(f"图表下载链接: file:///{os.path.abspath(chart_path)}") print(f"数据下载链接: file:///{os.path.abspath(output_path)}")
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-07 | fail→pass | 8,781 | 6,630 | -24% | 1 | 1 | 0% | 1,719 | 3,602 | +110% | 0 | 0 | — |
case-01 | fail→fail | 26,499 | 20,866 | -21% | 1 | 1 | 0% | 5,792 | 6,057 | +5% | 0 | 0 | — |
case-02 | fail→fail | 21,126 | 19,432 | -8% | 1 | 1 | 0% | 4,366 | 5,722 | +31% | 0 | 0 | — |
case-03 | fail→fail | 27,881 | 25,956 | -7% | 1 | 1 | 0% | 6,239 | 7,137 | +14% | 0 | 0 | — |
case-04 | fail→pass | 13,872 | 7,493 | -46% | 1 | 1 | 0% | 2,184 | 3,318 | +52% | 0 | 0 | — |
case-05 | fail→pass | 29,182 | 12,732 | -56% | 1 | 1 | 0% | 3,013 | 4,876 | +62% | 0 | 0 | — |
case-06 | fail→pass | 10,795 | 6,490 | -40% | 1 | 1 | 0% | 2,117 | 3,507 | +66% | 0 | 0 | — |
case-08 | fail→fail | 7,661 | 4,133 | -46% | 1 | 1 | 0% | 1,195 | 3,026 | +153% | 0 | 0 | — |
case-09 | fail→fail | 11,217 | 6,850 | -39% | 1 | 1 | 0% | 1,639 | 3,605 | +120% | 0 | 0 | — |
case-10 | fail→fail | 11,297 | 10,450 | -7% | 1 | 1 | 0% | 2,230 | 4,316 | +94% | 0 | 0 | — |
case-11 | fail→pass | 7,519 | 4,564 | -39% | 1 | 1 | 0% | 1,432 | 3,134 | +119% | 0 | 0 | — |
case-12 | fail→fail | 9,588 | 9,683 | +1% | 1 | 1 | 0% | 2,013 | 4,265 | +112% | 0 | 0 | — |
case-13 | fail→pass | 8,492 | 7,212 | -15% | 1 | 1 | 0% | 1,722 | 3,813 | +121% | 0 | 0 | — |
case-14 | fail→pass | 12,793 | 9,613 | -25% | 1 | 1 | 0% | 2,539 | 3,497 | +38% | 0 | 0 | — |
case-15 | pass→pass | 11,767 | 9,500 | -19% | 1 | 1 | 0% | 2,367 | 3,814 | +61% | 0 | 0 | — |
case-16 | pass→pass | 7,805 | 4,108 | -47% | 1 | 1 | 0% | 1,570 | 3,019 | +92% | 0 | 0 | — |
case-17 | fail→fail | 14,104 | 13,509 | -4% | 1 | 1 | 0% | 2,839 | 4,857 | +71% | 0 | 0 | — |
case-18 | fail→fail | 9,565 | 7,947 | -17% | 1 | 1 | 0% | 1,980 | 3,933 | +99% | 0 | 0 | — |
case-19 | fail→fail | 13,360 | 10,568 | -21% | 1 | 1 | 0% | 2,616 | 4,406 | +68% | 0 | 0 | — |
case-20 | pass→pass | 15,803 | 15,451 | -2% | 1 | 1 | 0% | 3,024 | 5,297 | +75% | 0 | 0 | — |
case-21 | pass→pass | 16,063 | 13,543 | -16% | 1 | 1 | 0% | 2,405 | 4,947 | +106% | 0 | 0 | — |
case-22 | pass→pass | 10,990 | 10,470 | -5% | 1 | 1 | 0% | 1,767 | 4,570 | +159% | 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 +32 percentage points is the difference between those two pass rates over the 22 comparable cases.
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.