---
title: experimental.unpivot() function
description: experimental.unpivot() creates _field and _value columns pairs using all columns (other than _time) not in the group key. The _field column contains the original column label and the _value column contains the original column value.
url: https://docs.influxdata.com/flux/v0/stdlib/experimental/unpivot/
estimated_tokens: 1375
product: Flux
version: v0
---

# experimental.unpivot() function

-   Flux 0.172.0+
-   View InfluxDB support

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

`experimental.unpivot()` creates `_field` and `_value` columns pairs using all columns (other than `_time`) *not* in the group key. The `_field` column contains the original column label and the `_value` column contains the original column value.

The output stream retains the group key and all group key columns of the input stream. `_field` is added to the output group key.

##### Function type signature

```js
(<-tables: stream[{A with _time: time}], ?otherColumns: [string]) => stream[{B with _value: C, _field: string}] where A: Record, B: Record
```

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

## Parameters

### tables

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

### otherColumns

List of column names that are not in the group key but are also not field columns. Default is `["_time"]`.

## Examples

### Unpivot data into \_field and \_value columns

```js
import "experimental"

data
    |> experimental.unpivot()
```

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

View example input and output

#### Input data

| _time | *location | temp | hum |
| --- | --- | --- | --- |
| 2022-01-01T00:00:00Z | Denver | 10.2 | 81.5 |
| 2022-01-02T00:00:00Z | Denver | 12.4 | 41.3 |

| _time | *location | temp | hum |
| --- | --- | --- | --- |
| 2022-01-01T00:00:00Z | New York | 50.1 | 99.2 |
| 2022-01-02T00:00:00Z | New York | 55.8 | 97.7 |

#### Output data

| *location | *_field | _time | _value |
| --- | --- | --- | --- |
| Denver | hum | 2022-01-01T00:00:00Z | 81.5 |
| Denver | hum | 2022-01-02T00:00:00Z | 41.3 |

| *location | *_field | _time | _value |
| --- | --- | --- | --- |
| New York | hum | 2022-01-01T00:00:00Z | 99.2 |
| New York | hum | 2022-01-02T00:00:00Z | 97.7 |

| *location | *_field | _time | _value |
| --- | --- | --- | --- |
| Denver | temp | 2022-01-01T00:00:00Z | 10.2 |
| Denver | temp | 2022-01-02T00:00:00Z | 12.4 |

| *location | *_field | _time | _value |
| --- | --- | --- | --- |
| New York | temp | 2022-01-01T00:00:00Z | 50.1 |
| New York | temp | 2022-01-02T00:00:00Z | 55.8 |

[transformations](/flux/v0/tags/transformations/)
