home / skills / dkyazzentwatwa / chatgpt-skills / pivot-table-generator

pivot-table-generator skill

/pivot-table-generator

This skill generates pivot tables from CSV/Excel with aggregations, filters, multi-level grouping, and auto charts to streamline data analysis.

npx playbooks add skill dkyazzentwatwa/chatgpt-skills --skill pivot-table-generator

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
692 B
---
name: pivot-table-generator
description: Generate pivot tables from CSV/Excel with aggregations, filters, and automatic chart creation.
---

# Pivot Table Generator

Create pivot tables with aggregations and visualizations.

## Features

- **Multiple Aggregations**: Sum, mean, count, min, max
- **Filtering**: Filter data before pivoting
- **Grouping**: Multi-level row/column grouping
- **Charts**: Auto-generate pivot charts
- **Export**: Excel, CSV, HTML output

## CLI Usage

```bash
python pivot_table_generator.py --data sales.csv --rows region --columns product --values amount --agg sum
```

## Dependencies

- pandas>=2.0.0
- numpy>=1.24.0
- matplotlib>=3.7.0
- openpyxl>=3.1.0

Overview

This skill generates pivot tables and matching visualizations from CSV or Excel files to accelerate exploratory analysis and reporting. It supports multiple aggregation functions, multi-level grouping, pre-pivot filtering, and exports to Excel, CSV, or HTML. Designed for quick CLI or programmatic use, it streamlines turning raw tabular data into summarized tables and charts.

How this skill works

Provide a data file and specify row/column groupings, value fields, and aggregation functions. The skill loads the data with pandas, applies optional filters, computes the pivot using multiple aggregations (sum, mean, count, min, max), and creates auto-formatted charts with matplotlib. Outputs can be saved as Excel, CSV, or standalone HTML containing both the table and chart.

When to use it

  • Summarizing large transactional or sales datasets by region, product, or time period
  • Creating multi-level summaries for stakeholder reports or dashboards
  • Quickly exploring aggregation patterns before building production analytics
  • Exporting summarized tables and charts for presentations or emailing to stakeholders
  • Filtering and pivoting data as a preprocessing step for downstream analysis

Best practices

  • Clean and normalize source data (consistent datatypes, no mixed-type columns) before pivoting
  • Define filters to reduce dataset size and improve performance on large files
  • Choose appropriate aggregation(s) for each value column to avoid misleading summaries
  • Limit very high-cardinality fields as pivot rows/columns to keep tables readable
  • Save outputs as Excel when recipients need editable results, use HTML for interactive viewing

Example use cases

  • Daily sales summary by region and product with sum and count aggregations and an exportable chart
  • Customer churn analysis: pivot by cohort and month with mean and count to track retention
  • Financial reporting: multi-level pivot by department and account with min/max and sum for audit-ready spreadsheets
  • Ad-hoc exploration: apply filters to a large CSV and generate a quick pivot chart to present trends
  • Automated pipeline: include pivot generation step to produce weekly HTML reports for stakeholders

FAQ

What input formats are supported?

CSV and Excel files are supported; the tool uses pandas to read both formats.

Which aggregations are available?

Built-in aggregations include sum, mean, count, min, and max; multiple aggregations can be applied to different value fields.