> 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/fill.md).

# Fill

> Fill nulls with a value, a neighbour or the mean.

Fills nulls in `columns` by `strategy`: a literal `value`, the previous or next non-null, zero, or the column mean. `forward` and `backward` follow the frame's current row order, so sort first.

Without `groupBy`, `forward`, `backward` and `mean` treat every row as one series. When the frame holds several series side by side (one per store, SKU or oven), set `groupBy` to the column naming that entity: each blank is then filled only from rows of its own group, so a store's first blank days stay blank instead of taking the last reading of the store sorted above it, and `mean` is that store's own mean. While no group is chosen, the inspector points out columns that look like such a key.

## At a glance

|                          |                        |
| ------------------------ | ---------------------- |
| Module type              | `Fill`                 |
| 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

### `value`

`string | number | boolean | null` · required · defaults to `null`

The literal used by the `value` strategy.

### `columns`

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

The columns whose nulls are filled.

### `strategy`

`"value" | "forward" | "backward" | "zero" | "mean"` · required · defaults to `"value"`

What to fill with: a literal, a neighbour, zero, or the column mean.

### `groupBy`

`string[]` · optional · defaults to `[]`

The columns that name which series a row belongs to. `forward`, `backward` and `mean` read only rows with the same values in these columns, keeping the frame's row order inside each group. With `columns` empty, the group columns themselves are not filled. `value` and `zero` ignore it.

## 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` | The frame with those nulls filled. |

***

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