Time Series And Categorical Analysis logo

Time Series And Categorical Analysis

OrganizationPopular
OpenSenseNova
time-series-and-categorical-analysis

对时间序列或分类数据进行多维度趋势分析、百分比清洗、绩效分级建模与预测,并生成高分辨率的可视化综合报告,适用于业务指标监控与预测场景。

Overview

PublisherOpenSenseNova
RepositorySenseNova-Skills
Skill nametime-series-and-categorical-analysis
Stars
5.6K
Forks
392
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by OpenSenseNova on GitHub. Read the source before you install it.

Installation

Install the Time Series And Categorical Analysis AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/OpenSenseNova/SenseNova-Skills.git /tmp/SenseNova-Skills
mkdir -p .claude/skills
cp -r /tmp/SenseNova-Skills/skills/sn-da-excel-workflow/capability/excel-data-analysis/time-series-analysis .claude/skills/time-series-and-categorical-analysis
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Time Series And Categorical Analysis in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Time Series And Categorical Analysis on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Time Series And Categorical Analysis is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Skill Steps

Step1 加载并检查原始数据,配置中文字体以确保图表正常显示。

python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')

# 设置中文字体,兼容不同操作系统
plt.rcParams['font.sans-serif'] = ['SimHei', 'WenQuanYi Zen Hei', 'DejaVu Sans']
plt.rcParams['axes.unicode_minus'] = False

# 加载Excel文件
file_path = 'data.xlsx'
df = pd.read_excel(file_path)

print(f"数据形状: {df.shape}")
print(f"列名: {list(df.columns)}")

Step2 提取时间序列或分类维度数据,处理百分比格式,并计算变化趋势。

python
def convert_percentage(pct_str):
    """将百分比字符串转换为数值,处理空值和非字符串类型"""
    if pd.isna(pct_str):
        return None
    if isinstance(pct_str, str) and '%' in pct_str:
        try:
            return float(pct_str.replace('%', ''))
        except ValueError:
            return None
    return pct_str

time_col = '时间列'  # 占位示例
target_cols = ['指标1占比', '指标2占比', '指标3占比']  # 占位示例

# 转换百分比字符串为数值并提取数据
ts_df = df[[time_col] + target_cols].copy() if time_col in df.columns else df.copy()
for col in target_cols:
    if col in ts_df.columns:
        ts_df[col] = ts_df[col].apply(convert_percentage)
        
        # 计算变化趋势并识别状态
        diff_col = f'{col}_变化'
        trend_col = f'{col}_趋势'
        ts_df[diff_col] = ts_df[col].diff()
        ts_df[trend_col] = ['上升' if x > 0 else '下降' if x < 0 else '稳定' for x in ts_df[diff_col]]

Step3 基于数值进行多维度分级算法建模,映射差异化增长率并计算预测值。

python
group_col = '分组列'  # 占位示例,如'部门'
value_col = '数值列'  # 占位示例,如'销售额'

# 聚合计算总和并排序
grouped_df = df.groupby(group_col, as_index=False)[value_col].sum()
grouped_df = grouped_df.sort_values(by=value_col, ascending=False).reset_index(drop=True)

# 多维度分级算法结构:前30%为高,中间40%为中,后30%为低
total_rows = len(grouped_df)
high_threshold = int(total_rows * 0.3)
mid_threshold = int(total_rows * 0.7)

grouped_df['等级'] = np.where(
    grouped_df.index < high_threshold, '高',
    np.where(grouped_df.index < mid_threshold, '中', '低')
)

# 分类映射函数骨架:为不同等级设定差异化增长率
growth_rates = {'高': 0.15, '中': 0.08, '低': 0.03}
grouped_df['增长率'] = grouped_df['等级'].map(growth_rates)

# 计算预测值与增长量
grouped_df['预测值'] = grouped_df[value_col] * (1 + grouped_df['增长率'])
grouped_df['增长量'] = grouped_df['预测值'] - grouped_df[value_col]

Step4 生成多维度可视化图表(堆叠面积图、柱状图、条形图),并保存为高分辨率图像。

python
output_path = 'trend_analysis_report.png'
plt.figure(figsize=(14, 10))

# 子图1:堆叠面积图(时间序列占比变化)
plt.subplot(2, 2, 1)
sns.set_style('whitegrid')
if time_col in ts_df.columns and all(c in ts_df.columns for c in target_cols):
    plt.stackplot(ts_df[time_col], 
                  *[ts_df[c] for c in target_cols], 
                  labels=target_cols, alpha=0.8)
    plt.title('各指标占比变化趋势', fontsize=14, fontweight='bold')
    plt.xlabel(time_col)
    plt.ylabel('占比 (%)')
    plt.legend(loc='upper left')
    plt.xticks(rotation=45)

# 子图2:当前 vs 预测对比(柱状图)
plt.subplot(2, 2, 2)
x = np.arange(len(grouped_df))
width = 0.35
plt.bar(x - width/2, grouped_df[value_col], width, label='当前值', alpha=0.8)
plt.bar(x + width/2, grouped_df['预测值'], width, label='预测值', alpha=0.8)
plt.xlabel(group_col)
plt.ylabel('数值')
plt.title('当前与预测值对比')
plt.xticks(x, grouped_df[group_col], rotation=45)
plt.legend()

# 子图3:增长率分布(条形图)
plt.subplot(2, 2, 3)
plt.barh(grouped_df[group_col], grouped_df['增长率'], color='skyblue')
plt.xlabel('增长率')
plt.title('各组增长率分布')
plt.gca().invert_yaxis()

# 子图4:增长量分布(柱状图)
plt.subplot(2, 2, 4)
plt.bar(grouped_df[group_col], grouped_df['增长量'], color='lightcoral')
plt.xlabel(group_col)
plt.ylabel('增长量')
plt.title('各组增长量分析')
plt.xticks(rotation=45)

plt.tight_layout()
# 图表美化与高分辨率保存
plt.savefig(output_path, dpi=300, bbox_inches='tight')
plt.close()

Step5 生成综合分析报告,汇总核心指标并输出趋势结论。

python
# 总体预测汇总
total_current = grouped_df[value_col].sum()
total_forecast = grouped_df['预测值'].sum()
total_growth = grouped_df['增长量'].sum()
overall_growth_rate = (total_forecast - total_current) / total_current if total_current else 0

print("=" * 60)
print("📊 综合趋势分析报告")
print("=" * 60)
print(f"当前总值: {total_current:,.2f}")
print(f"预测总值: {total_forecast:,.2f}")
print(f"总增长量: {total_growth:,.2f}")
print(f"整体增长率: {overall_growth_rate:.2%}")
print("\n📈 分析结论:")
if overall_growth_rate > 0.1:
    print("  - 整体趋势向好,预计实现显著增长。")
elif overall_growth_rate > 0:
    print("  - 呈温和增长态势,建议加强低等级组支持。")
else:
    print("  - 预测下滑,需深入分析原因并制定应对策略。")
print("=" * 60)

Frequently asked questions

What does the Time Series And Categorical Analysis AI skill do?

对时间序列或分类数据进行多维度趋势分析、百分比清洗、绩效分级建模与预测,并生成高分辨率的可视化综合报告,适用于业务指标监控与预测场景。

Why use Time Series And Categorical Analysis on TypingMind?

Because you install it once and use it with any model. Time Series And Categorical Analysis is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Time Series And Categorical Analysis in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/OpenSenseNova/SenseNova-Skills/tree/main/skills/sn-da-excel-workflow/capability/excel-data-analysis/time-series-analysis. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Time Series And Categorical Analysis?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Time Series And Categorical Analysis?

As many as you like. As long as a model supports skills, you can use Time Series And Categorical Analysis with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Time Series And Categorical Analysis AI skill free?

Yes. It is published on GitHub by OpenSenseNova under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇