> For the complete documentation index, see [llms.txt](https://docs.rootcause.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rootcause.ai/more-details/applications/application-modules/resample.md).

# Resample

> Bucket a time column to a cadence and aggregate each bucket.

Buckets `timeColumn` to a cadence and aggregates each bucket with `fn`, optionally within `groupBy`. It is a `GROUP BY` over a bucketing expression and nothing more: there is no date spine, so a period with no rows produces no row. Plot or join a resampled series and the gaps are still gaps.

## At a glance

|                          |                        |
| ------------------------ | ---------------------- |
| Module type              | `Resample`             |
| Category                 | Primitives · Dataframe |
| Default tier             | `reactive`             |
| Runs on                  | `reactive`, `durable`  |
| Starts a flow            | no                     |
| Holds a body             | no                     |
| Keeps state between runs | no                     |
| Available in             | every application type |

## Parameters

### `every`

`string` · required · defaults to `"1d"`

The bucket width, as a duration like `1d` or `1w`.

### `timeColumn`

`string` · required · defaults to `""`

The datetime column bucketed.

### `groupBy`

`string[]` · required · defaults to `[]`

Resample within each of these groups rather than across the frame.

### `fn`

`"sum" | "avg" | "min" | "max" | "count" | "countDistinct" | "median" | "first" | "last"` · required · defaults to `"sum"`

How the rows in a bucket are aggregated.

## Inputs

| Port   | Kind        | Required | Description                                                                                                                           |
| ------ | ----------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `on`   | `event`     | no       | Implicit on every module that does not itself start a flow: wire an event here to make this module the start of what that event runs. |
| `data` | `dataframe` | yes      | The frame to work on.                                                                                                                 |

## Outputs

| Port     | Kind        | Connects to           | Description                                  |
| -------- | ----------- | --------------------- | -------------------------------------------- |
| `output` | `dataframe` | `dataframe`, `signal` | One row per bucket that had rows, per group. |

***

[← All application modules](/more-details/applications/application-modules.md)
