group_by_aggregate
Group data by categories and calculate statistics like sum, mean, count, min, max to analyze patterns and trends across different segments.
Instructions
Group data and compute aggregations for analytical insights.
Performs GROUP BY operations with multiple aggregation functions per column. Essential for segmentation analysis and understanding patterns across different data groups.
Returns: Grouped aggregation results with statistics per group
Aggregation Functions: š count, mean, median, sum, min, max š std, var (statistical measures) šÆ first, last (positional) š nunique (unique count)
Examples: # Sales analysis by region result = await group_by_aggregate(ctx, group_by=["region"], aggregations={"sales": ["sum", "mean", "count"]})
AI Workflow Integration: 1. Segmentation analysis and market research 2. Feature engineering for categorical interactions 3. Data summarization for reporting and insights 4. Understanding group-based patterns and trends
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group_by | Yes | List of columns to group by for segmentation analysis | |
| aggregations | Yes | Dict mapping column names to list of aggregation functions |