{"data":{"slug":"github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-analysis-time-series-analysis-8f6d482a9a2a","title":"Multidimensional Analysis of Time Series and Categorical Data","summary":"Perform multidimensional trend analysis, percentage cleaning, performance grading modeling, and forecasting for time series or categorical data, and generate high-resolution visualized comprehensive reports, suitable for business metric monitoring and forecasting scenarios.","url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-analysis-time-series-analysis-8f6d482a9a2a","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-analysis-time-series-analysis-8f6d482a9a2a","markdown_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-analysis-time-series-analysis-8f6d482a9a2a.md","download_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-data-analysis-time-series-analysis-8f6d482a9a2a\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"The analysis requires a pre-prepared Excel file with specific columns such as '\u65f6\u95f4\u5217' (time column), '\u6307\u68071\u5360\u6bd4', '\u6307\u68072\u5360\u6bd4', '\u6307\u68073\u5360\u6bd4', and '\u5206\u7ec4\u5217' (grouping column). The user must ensure that the data is correctly formatted and that the required columns exist in the dataset.","instructions":"---\nname: time-series-and-categorical-analysis\ndescription: \"\u5bf9\u65f6\u95f4\u5e8f\u5217\u6216\u5206\u7c7b\u6570\u636e\u8fdb\u884c\u591a\u7ef4\u5ea6\u8d8b\u52bf\u5206\u6790\u3001\u767e\u5206\u6bd4\u6e05\u6d17\u3001\u7ee9\u6548\u5206\u7ea7\u5efa\u6a21\u4e0e\u9884\u6d4b\uff0c\u5e76\u751f\u6210\u9ad8\u5206\u8fa8\u7387\u7684\u53ef\u89c6\u5316\u7efc\u5408\u62a5\u544a\uff0c\u9002\u7528\u4e8e\u4e1a\u52a1\u6307\u6807\u76d1\u63a7\u4e0e\u9884\u6d4b\u573a\u666f\u3002\"\n---\n\n## Skill Steps\n\nStep1 \u52a0\u8f7d\u5e76\u68c0\u67e5\u539f\u59cb\u6570\u636e\uff0c\u914d\u7f6e\u4e2d\u6587\u5b57\u4f53\u4ee5\u786e\u4fdd\u56fe\u8868\u6b63\u5e38\u663e\u793a\u3002\n```python\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport warnings\nwarnings.filterwarnings('ignore')\n\n# \u8bbe\u7f6e\u4e2d\u6587\u5b57\u4f53\uff0c\u517c\u5bb9\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\nplt.rcParams['font.sans-serif'] = ['SimHei', 'WenQuanYi Zen Hei', 'DejaVu Sans']\nplt.rcParams['axes.unicode_minus'] = False\n\n# \u52a0\u8f7dExcel\u6587\u4ef6\nfile_path = 'data.xlsx'\ndf = pd.read_excel(file_path)\n\nprint(f\"\u6570\u636e\u5f62\u72b6: {df.shape}\")\nprint(f\"\u5217\u540d: {list(df.columns)}\")\n```\n\nStep2 \u63d0\u53d6\u65f6\u95f4\u5e8f\u5217\u6216\u5206\u7c7b\u7ef4\u5ea6\u6570\u636e\uff0c\u5904\u7406\u767e\u5206\u6bd4\u683c\u5f0f\uff0c\u5e76\u8ba1\u7b97\u53d8\u5316\u8d8b\u52bf\u3002\n```python\ndef convert_percentage(pct_str):\n    \"\"\"\u5c06\u767e\u5206\u6bd4\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6570\u503c\uff0c\u5904\u7406\u7a7a\u503c\u548c\u975e\u5b57\u7b26\u4e32\u7c7b\u578b\"\"\"\n    if pd.isna(pct_str):\n        return None\n    if isinstance(pct_str, str) and '%' in pct_str:\n        try:\n            return float(pct_str.replace('%', ''))\n        except ValueError:\n            return None\n    return pct_str\n\ntime_col = '\u65f6\u95f4\u5217'  # \u5360\u4f4d\u793a\u4f8b\ntarget_cols = ['\u6307\u68071\u5360\u6bd4', '\u6307\u68072\u5360\u6bd4', '\u6307\u68073\u5360\u6bd4']  # \u5360\u4f4d\u793a\u4f8b\n\n# \u8f6c\u6362\u767e\u5206\u6bd4\u5b57\u7b26\u4e32\u4e3a\u6570\u503c\u5e76\u63d0\u53d6\u6570\u636e\nts_df = df[[time_col] + target_cols].copy() if time_col in df.columns else df.copy()\nfor col in target_cols:\n    if col in ts_df.columns:\n        ts_df[col] = ts_df[col].apply(convert_percentage)\n        \n        # \u8ba1\u7b97\u53d8\u5316\u8d8b\u52bf\u5e76\u8bc6\u522b\u72b6\u6001\n        diff_col = f'{col}_\u53d8\u5316'\n        trend_col = f'{col}_\u8d8b\u52bf'\n        ts_df[diff_col] = ts_df[col].diff()\n        ts_df[trend_col] = ['\u4e0a\u5347' if x > 0 else '\u4e0b\u964d' if x < 0 else '\u7a33\u5b9a' for x in ts_df[diff_col]]\n```\n\nStep3 \u57fa\u4e8e\u6570\u503c\u8fdb\u884c\u591a\u7ef4\u5ea6\u5206\u7ea7\u7b97\u6cd5\u5efa\u6a21\uff0c\u6620\u5c04\u5dee\u5f02\u5316\u589e\u957f\u7387\u5e76\u8ba1\u7b97\u9884\u6d4b\u503c\u3002\n```python\ngroup_col = '\u5206\u7ec4\u5217'  # \u5360\u4f4d\u793a\u4f8b\uff0c\u5982'\u90e8\u95e8'\nvalue_col = '\u6570\u503c\u5217'  # \u5360\u4f4d\u793a\u4f8b\uff0c\u5982'\u9500\u552e\u989d'\n\n# \u805a\u5408\u8ba1\u7b97\u603b\u548c\u5e76\u6392\u5e8f\ngrouped_df = df.groupby(group_col, as_index=False)[value_col].sum()\ngrouped_df = grouped_df.sort_values(by=value_col, ascending=False).reset_index(drop=True)\n\n# \u591a\u7ef4\u5ea6\u5206\u7ea7\u7b97\u6cd5\u7ed3\u6784\uff1a\u524d30%\u4e3a\u9ad8\uff0c\u4e2d\u95f440%\u4e3a\u4e2d\uff0c\u540e30%\u4e3a\u4f4e\ntotal_rows = len(grouped_df)\nhigh_threshold = int(total_rows * 0.3)\nmid_threshold = int(total_rows * 0.7)\n\ngrouped_df['\u7b49\u7ea7'] = np.where(\n    grouped_df.index < high_threshold, '\u9ad8',\n    np.where(grouped_df.index < mid_threshold, '\u4e2d', '\u4f4e')\n)\n\n# \u5206\u7c7b\u6620\u5c04\u51fd\u6570\u9aa8\u67b6\uff1a\u4e3a\u4e0d\u540c\u7b49\u7ea7\u8bbe\u5b9a\u5dee\u5f02\u5316\u589e\u957f\u7387\ngrowth_rates = {'\u9ad8': 0.15, '\u4e2d': 0.08, '\u4f4e': 0.03}\ngrouped_df['\u589e\u957f\u7387'] = grouped_df['\u7b49\u7ea7'].map(growth_rates)\n\n# \u8ba1\u7b97\u9884\u6d4b\u503c\u4e0e\u589e\u957f\u91cf\ngrouped_df['\u9884\u6d4b\u503c'] = grouped_df[value_col] * (1 + grouped_df['\u589e\u957f\u7387'])\ngrouped_df['\u589e\u957f\u91cf'] = grouped_df['\u9884\u6d4b\u503c'] - grouped_df[value_col]\n```\n\nStep4 \u751f\u6210\u591a\u7ef4\u5ea6\u53ef\u89c6\u5316\u56fe\u8868\uff08\u5806\u53e0\u9762\u79ef\u56fe\u3001\u67f1\u72b6\u56fe\u3001\u6761\u5f62\u56fe\uff09\uff0c\u5e76\u4fdd\u5b58\u4e3a\u9ad8\u5206\u8fa8\u7387\u56fe\u50cf\u3002\n```python\noutput_path = 'trend_analysis_report.png'\nplt.figure(figsize=(14, 10))\n\n# \u5b50\u56fe1\uff1a\u5806\u53e0\u9762\u79ef\u56fe\uff08\u65f6\u95f4\u5e8f\u5217\u5360\u6bd4\u53d8\u5316\uff09\nplt.subplot(2, 2, 1)\nsns.set_style('whitegrid')\nif time_col in ts_df.columns and all(c in ts_df.columns for c in target_cols):\n    plt.stackplot(ts_df[time_col], \n                  *[ts_df[c] for c in target_cols], \n                  labels=target_cols, alpha=0.8)\n    plt.title('\u5404\u6307\u6807\u5360\u6bd4\u53d8\u5316\u8d8b\u52bf', fontsize=14, fontweight='bold')\n    plt.xlabel(time_col)\n    plt.ylabel('\u5360\u6bd4 (%)')\n    plt.legend(loc='upper left')\n    plt.xticks(rotation=45)\n\n# \u5b50\u56fe2\uff1a\u5f53\u524d vs \u9884\u6d4b\u5bf9\u6bd4\uff08\u67f1\u72b6\u56fe\uff09\nplt.subplot(2, 2, 2)\nx = np.arange(len(grouped_df))\nwidth = 0.35\nplt.bar(x - width\/2, grouped_df[value_col], width, label='\u5f53\u524d\u503c', alpha=0.8)\nplt.bar(x + width\/2, grouped_df['\u9884\u6d4b\u503c'], width, label='\u9884\u6d4b\u503c', alpha=0.8)\nplt.xlabel(group_col)\nplt.ylabel('\u6570\u503c')\nplt.title('\u5f53\u524d\u4e0e\u9884\u6d4b\u503c\u5bf9\u6bd4')\nplt.xticks(x, grouped_df[group_col], rotation=45)\nplt.legend()\n\n# \u5b50\u56fe3\uff1a\u589e\u957f\u7387\u5206\u5e03\uff08\u6761\u5f62\u56fe\uff09\nplt.subplot(2, 2, 3)\nplt.barh(grouped_df[group_col], grouped_df['\u589e\u957f\u7387'], color='skyblue')\nplt.xlabel('\u589e\u957f\u7387')\nplt.title('\u5404\u7ec4\u589e\u957f\u7387\u5206\u5e03')\nplt.gca().invert_yaxis()\n\n# \u5b50\u56fe4\uff1a\u589e\u957f\u91cf\u5206\u5e03\uff08\u67f1\u72b6\u56fe\uff09\nplt.subplot(2, 2, 4)\nplt.bar(grouped_df[group_col], grouped_df['\u589e\u957f\u91cf'], color='lightcoral')\nplt.xlabel(group_col)\nplt.ylabel('\u589e\u957f\u91cf')\nplt.title('\u5404\u7ec4\u589e\u957f\u91cf\u5206\u6790')\nplt.xticks(rotation=45)\n\nplt.tight_layout()\n# \u56fe\u8868\u7f8e\u5316\u4e0e\u9ad8\u5206\u8fa8\u7387\u4fdd\u5b58\nplt.savefig(output_path, dpi=300, bbox_inches='tight')\nplt.close()\n```\n\nStep5 \u751f\u6210\u7efc\u5408\u5206\u6790\u62a5\u544a\uff0c\u6c47\u603b\u6838\u5fc3\u6307\u6807\u5e76\u8f93\u51fa\u8d8b\u52bf\u7ed3\u8bba\u3002\n```python\n# \u603b\u4f53\u9884\u6d4b\u6c47\u603b\ntotal_current = grouped_df[value_col].sum()\ntotal_forecast = grouped_df['\u9884\u6d4b\u503c'].sum()\ntotal_growth = grouped_df['\u589e\u957f\u91cf'].sum()\noverall_growth_rate = (total_forecast - total_current) \/ total_current if total_current else 0\n\nprint(\"=\" * 60)\nprint(\"\ud83d\udcca \u7efc\u5408\u8d8b\u52bf\u5206\u6790\u62a5\u544a\")\nprint(\"=\" * 60)\nprint(f\"\u5f53\u524d\u603b\u503c: {total_current:,.2f}\")\nprint(f\"\u9884\u6d4b\u603b\u503c: {total_forecast:,.2f}\")\nprint(f\"\u603b\u589e\u957f\u91cf: {total_growth:,.2f}\")\nprint(f\"\u6574\u4f53\u589e\u957f\u7387: {overall_growth_rate:.2%}\")\nprint(\"\\n\ud83d\udcc8 \u5206\u6790\u7ed3\u8bba\uff1a\")\nif overall_growth_rate > 0.1:\n    print(\"  - \u6574\u4f53\u8d8b\u52bf\u5411\u597d\uff0c\u9884\u8ba1\u5b9e\u73b0\u663e\u8457\u589e\u957f\u3002\")\nelif overall_growth_rate > 0:\n    print(\"  - \u5448\u6e29\u548c\u589e\u957f\u6001\u52bf\uff0c\u5efa\u8bae\u52a0\u5f3a\u4f4e\u7b49\u7ea7\u7ec4\u652f\u6301\u3002\")\nelse:\n    print(\"  - \u9884\u6d4b\u4e0b\u6ed1\uff0c\u9700\u6df1\u5165\u5206\u6790\u539f\u56e0\u5e76\u5236\u5b9a\u5e94\u5bf9\u7b56\u7565\u3002\")\nprint(\"=\" * 60)\n```\n","use_cases":["Business Metric Monitoring and Forecasting","Performance Grading Modeling and Analysis","Data Visualization and Report Generation"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/OpenSenseNova\/SenseNova-Skills\/blob\/07e7ff8c4bdfd7b79e7402fe94af59d2a5a9749b\/skills\/sn-da-excel-workflow\/capability\/excel-data-analysis\/time-series-analysis\/SKILL.md","source_commit":"07e7ff8c4bdfd7b79e7402fe94af59d2a5a9749b","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-15T07:54:07.000000Z","updated_at":"2026-11-16T05:16:30.000000Z","seo_title":"Multidimensional Analysis Tool for Time Series and Categorical Data","seo_description":"Perform multidimensional trend analysis, percentage cleaning, performance grading modeling, and forecasting for time series or categorical data, and generate high-resulst","seo_keywords":["Time Series Analysis Tool","Categorical Data Visualization","Performance Grading Modeling","Business Metric Forecasting","Data Trend Analysis"]}}