Skip to content
Back to skills

Typed Panel Aggregation

ASecurity

Aggregate panel/sequential data with type-appropriate statistics — numeric (mean/std/min/max/last) and categorical (count/last/nunique) — then concat into flat features

  • 61 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 12, 2026
datapythongoexpress

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill typed-panel-aggregation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Typed Panel Aggregation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Typed Panel Aggregation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-typed-panel-aggregation/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-typed-panel-aggregation)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: tabular-typed-panel-aggregation
description: Aggregate panel/sequential data with type-appropriate statistics — numeric (mean/std/min/max/last) and categorical (count/last/nunique) — then concat into flat features
domain: tabular
---

# Typed Panel Aggregation

## Overview

When customer or entity data arrives as multiple time-stamped rows (panel data), flatten to one row per entity by applying different aggregation functions per column type. Numeric columns get mean, std, min, max, last; categorical columns get count, last, nunique. This type-aware approach extracts richer signals than uniform aggregation.

## Quick Start

```python
import pandas as pd

def typed_panel_agg(df, group_col, cat_features, num_features=None):
    """Aggregate panel data with type-appropriate statistics.
    
    Args:
        df: DataFrame with multiple rows per entity
        group_col: entity identifier column
        cat_features: list of categorical column names
        num_features: list of numeric columns (default: all non-cat)
    """
    if num_features is None:
        num_features = [c for c in df.columns
                        if c not in cat_features + [group_col]]
    
    num_agg = df.groupby(group_col)[num_features].agg(
        ['mean', 'std', 'min', 'max', 'last'])
    num_agg.columns = ['_'.join(x) for x in num_agg.columns]
    
    cat_agg = df.groupby(group_col)[cat_features].agg(
        ['count', 'last', 'nunique'])
    cat_agg.columns = ['_'.join(x) for x in cat_agg.columns]
    
    return pd.concat([num_agg, cat_agg], axis=1)
```

## Key Decisions

- **Numeric stats**: std captures volatility; last captures recency; min/max capture extremes
- **Categorical stats**: nunique captures diversity; count captures engagement frequency
- **GPU acceleration**: use cuDF `groupby().agg()` for datasets with millions of rows
- **Curated stat lists**: optionally select which stats per feature to reduce dimensionality

## References

- Source: [xgboost-starter-0-793](https://www.kaggle.com/code/cdeotte/xgboost-starter-0-793)
- Competition: American Express - Default Prediction

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.