# Pivot

The Pivot step allows to transform rows into columns. It is the reverse operation of an `unpivot` step.

Pivoting a column into several columns means that every unique label found in that column becomes a column header. The column gets pivoted “around” fixed columns that you can specify. You also need to specify a value column where values will be found to fill pivoted columns. If aggregation needs to be performed, you can choose the aggregation function (`sum` by default).

### Step parameters

* `Keep columns...`: the columns to remain fixed, around which the pivot will occur
* `Pivot column...`: the column to be pivoted
* `Use values in...`: the columns where values are found to fill the pivoted columns
* `Aggregate values using...`: the aggregation function to be used when aggregation has to be performed

### Example

**Input**

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-b0a89aa1fa9e491e26305f8abb9afbabde309c7b%2Fpivot_input.png?alt=media" alt=""><figcaption><p>Reshape - pivot input</p></figcaption></figure>

**Configuration**

```json
{
    "index": ["Label"],
    "column_to_pivot": "Country",
    "value_column": "Value", 
    "aggfunction": "sum"
}
```

**Output**

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-9de3f88c133d4c23ce13648b9e328d988df20dd8%2Fpivot_output.png?alt=media" alt=""><figcaption><p>Reshape - pivot output</p></figcaption></figure>
