---
title: experimental.group() function
description: experimental.group() introduces an extend mode to the existing group() function.
url: https://docs.influxdata.com/flux/v0/stdlib/experimental/group/
estimated_tokens: 963
product: Flux
version: v0
publisher: InfluxData
canonical: https://docs.influxdata.com/flux/v0/stdlib/experimental/group/
date: '2024-04-08T16:01:02-06:00'
lastmod: '2024-04-08T16:01:02-06:00'
---

* Flux 0.39.0+

InfluxDB support

> [!Important]
> `experimental.group()` is [subject to change at any time](/flux/v0/stdlib/experimental/#experimental-packages-are-subject-to-change).

`experimental.group()` introduces an `extend` mode to the existing `group()` function.

##### Function type signature

```js
(<-tables: stream[A], columns: [string], mode: string) => stream[A] where A: Record
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### columns

(Required)
List of columns to use in the grouping operation. Default is `[]`.

### mode

(Required)
Grouping mode. `extend` is the only mode available to `experimental.group()`.

#### Grouping modes

* **extend**: Appends columns defined in the `columns` parameter to group keys.

### tables

Input data. Default is piped-forward data (`<-`).

## Examples

### Add a column to the group key

```js
import "experimental"

data
    |> experimental.group(columns: ["region"], mode: "extend")
```

[](#view-example-input-and-output)

View example input and output

#### Input data

|       \_time       |\*host|region|\_value|
|--------------------|------|------|-------|
|2021-01-01T00:00:00Z|host1 | east |  41   |
|2021-01-01T00:01:00Z|host1 | east |  48   |
|2021-01-01T00:00:00Z|host1 | west |  34   |
|2021-01-01T00:01:00Z|host1 | west |  12   |

|       \_time       |\*host|region|\_value|
|--------------------|------|------|-------|
|2021-01-01T00:00:00Z|host2 | east |  56   |
|2021-01-01T00:01:00Z|host2 | east |  72   |
|2021-01-01T00:00:00Z|host2 | west |  43   |
|2021-01-01T00:01:00Z|host2 | west |  22   |

#### Output data

|       \_time       |\*host|\*region|\_value|
|--------------------|------|--------|-------|
|2021-01-01T00:00:00Z|host1 |  east  |  41   |
|2021-01-01T00:01:00Z|host1 |  east  |  48   |

|       \_time       |\*host|\*region|\_value|
|--------------------|------|--------|-------|
|2021-01-01T00:00:00Z|host1 |  west  |  34   |
|2021-01-01T00:01:00Z|host1 |  west  |  12   |

|       \_time       |\*host|\*region|\_value|
|--------------------|------|--------|-------|
|2021-01-01T00:00:00Z|host2 |  east  |  56   |
|2021-01-01T00:01:00Z|host2 |  east  |  72   |

|       \_time       |\*host|\*region|\_value|
|--------------------|------|--------|-------|
|2021-01-01T00:00:00Z|host2 |  west  |  43   |
|2021-01-01T00:01:00Z|host2 |  west  |  22   |

#### Related

* [group() function](/flux/v0/stdlib/universe/group/)

[transformations](/flux/v0/tags/transformations/)
| _time | *host | region | _value |
| --- | --- | --- | --- |
| _time | *host | region | _value |
| 2021-01-01T00:00:00Z | host1 | east | 41 |
| 2021-01-01T00:01:00Z | host1 | east | 48 |
| 2021-01-01T00:00:00Z | host1 | west | 34 |
| 2021-01-01T00:01:00Z | host1 | west | 12 |

| _time | *host | region | _value |
| --- | --- | --- | --- |
| _time | *host | region | _value |
| 2021-01-01T00:00:00Z | host2 | east | 56 |
| 2021-01-01T00:01:00Z | host2 | east | 72 |
| 2021-01-01T00:00:00Z | host2 | west | 43 |
| 2021-01-01T00:01:00Z | host2 | west | 22 |

| _time | *host | *region | _value |
| --- | --- | --- | --- |
| _time | *host | *region | _value |
| 2021-01-01T00:00:00Z | host1 | east | 41 |
| 2021-01-01T00:01:00Z | host1 | east | 48 |

| _time | *host | *region | _value |
| --- | --- | --- | --- |
| _time | *host | *region | _value |
| 2021-01-01T00:00:00Z | host1 | west | 34 |
| 2021-01-01T00:01:00Z | host1 | west | 12 |

| _time | *host | *region | _value |
| --- | --- | --- | --- |
| _time | *host | *region | _value |
| 2021-01-01T00:00:00Z | host2 | east | 56 |
| 2021-01-01T00:01:00Z | host2 | east | 72 |

| _time | *host | *region | _value |
| --- | --- | --- | --- |
| _time | *host | *region | _value |
| 2021-01-01T00:00:00Z | host2 | west | 43 |
| 2021-01-01T00:01:00Z | host2 | west | 22 |
