pivot-table-generator
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "pivot-table-generator" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-09b944032518d584e3773a7c8a1f1c606a844f9fdddb043e9b0640ad9a8a05be. Verify the upstream source and version against https://skillhub.cn/skills/user_8451910d/pivot-table-generator before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Generate a pivot table from a source Excel file and add it as a new sheet: rows = product name, columns = store custom ID, values = sum of store order demand, include a total column and sort by total descending.
Introduction source: third_party · user_8451910d · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Audience
- Not specified in the source documentation.
- Inputs and outputs
- Not specified in the source documentation.
- Software, accounts and paid services
- Translation pending; see source documentation.
- Limits and differences
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: pivot-table-generator
description: 从数据源Excel文件生成数据透视表,以新sheet页添加到原文件中。行=商品名称,列=门店自定义序号,值=求和:门店订货需求数,加总计列并按从大到小排序。
triggers:
- 用户提供一个数据源文件(xlsx),要求做数据透视表
- 用户说"做个透视表"、"生成透视表"、"pivot table"、"数据透视"
- 用户在文档处理场景下给了一个文件
- 关键词: 透视表、pivot、门店订货需求数、商品名称、门店自定义序号
agent_created: truePivot Table Generator
触发条件
当用户提供一个 Excel 数据源文件,并需要生成数据透视表时使用此技能。
触发关键词:透视表、pivot、门店订货需求数、商品名称、门店自定义序号、做个表、数据透视
数据透视表规则
- 行 (Rows): 商品名称
- 列 (Columns): 门店自定义序号
- 值 (Values): 求和项:门店订货需求数
- 总计列: 在商品名称后面添加一列"总计",值为该商品所有门店的订货需求数之和
- 排序: 按总计列从大到小排序(降序)
- 列合计行: 在第二行(表头下方)添加一行"合计",汇总每一列所有商品的数据之和
- 输出位置: 以新的 sheet 页添加到用户提供的原始数据源文件中
执行流程
Step 1: 读取数据源文件
用 openpyxl 或 pandas 读取用户提供的 xlsx 文件,获取所有数据列名,确认以下字段存在:
- 商品名称
- 门店自定义序号
- 门店订货需求数
如果列名不完全匹配,检查是否存在相似列名(如"门店订货需求"等),并告知用户确认。
Step 2: 生成透视表数据
用 pandas 生成 pivot_table:
pivot = df.pivot_table(
index='商品名称',
columns='门店自定义序号',
values='门店订货需求数',
aggfunc='sum',
fill_value=0
)
Step 3: 添加总计列并排序
pivot['总计'] = pivot.sum(axis=1)
pivot = pivot.sort_values('总计', ascending=False)
将"总计"列移到商品名称后面(即DataFrame的第二列位置)。
Step 4: 写入新 sheet 页
使用 openpyxl 将透视表数据写入原文件的新 sheet 页:
- sheet 页名称: "数据透视表"(如果已存在则追加日期后缀避免冲突)
- 第一行写列标题(门店自定义序号值 + "总计")
- 第二行写"合计"行,汇总每一列所有商品的数值之和
- 第一列写商品名称(从第三行开始)
- 保持原文件所有内容不变,仅在末尾新增 sheet
Step 5: 格式美化
- 表头行加粗、居中
- 数值列右对齐
- 添加边框线
- 冻结首行和首列方便查看
- 列宽自适应
注意事项
- 不要修改原文件中的任何现有数据或 sheet 页
- 如果某个商品在某门店没有数据,对应单元格填 0
- 门店自定义序号列的各值作为透视表的列标题
- 输出文件即原文件本身(不是另存为新文件)
- 完成后告知用户透视表已添加到哪个 sheet 页
依赖
- openpyxl
- pandas
使用隔离的 Python 环境安装:
C:\Users\Administrator\.workbuddy\binaries\python\envs\default\Scripts\pip.exe install openpyxl pandas
运行脚本:
C:\Users\Administrator\.workbuddy\binaries\python\envs\default\Scripts\python.exe <script_path>Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决 Excel 数据透视表生成这一明确办公场景需求
- 具有广泛受众和实用价值,属于通用工具范畴
Highlights
- 触发词覆盖合理,关键词明确,边界清晰
Highlights
- Phase/步骤清晰,有出口条件,含端到端示例
- frontmatter 完整,单文件未超 500 行
Highlights
- 工具来源明确,参数正确,覆盖主要异常
- 不可逆操作有明确说明,依赖安装命令完整
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Administrator or elevated privileges
Elevate only when necessary. Keep protection and certificate validation enabled and avoid broad system access.
Mentioned in main document · lines 95, 100
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Translation pending; see source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.