---
title: "Create custom aggregate functions (UDAs)"
description: "Build reusable aggregation logic for group-by queries and analytics."
url: "https://www.pixeltable.com/notebooks/custom-aggregates-uda"
updated: "2026-01-24"
---

# Create custom aggregate functions (UDAs)

Build reusable aggregation logic for group-by queries and analytics.

- **Type:** Notebook
- **Group:** Core Operations

## What it covers

- Define a UDA (User-Defined Aggregate) with the @pxt.uda decorator
- Use UDAs in group_by queries
- Create UDAs with multiple inputs

## What it uses

- **Install:** `pip install pixeltable`
- **Pixeltable calls:** `pxt.create_table()`, `@pxt.uda`, `insert()`, `group_by()`

## Open it

- **Open in Colab:** https://colab.research.google.com/github/pixeltable/pixeltable/blob/release/docs/release/howto/cookbooks/core/custom-aggregates-uda.ipynb
- **Docs page:** https://docs.pixeltable.com/howto/cookbooks/core/custom-aggregates-uda
- **Source on GitHub:** https://github.com/pixeltable/pixeltable/blob/release/docs/release/howto/cookbooks/core/custom-aggregates-uda.ipynb
