> ## Documentation Index
> Fetch the complete documentation index at: https://docs.exploratory.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Pivot

Pivot columns into rows and columns. Values are count of pairs of rows and columns or aggregation of another column.

## How to Access This Feature

![](https://mintcdn.com/exploratory-inc/TqmeqBdjk6dsTTLj/en/wrangling/images/command-pivot-menu.png?fit=max\&auto=format\&n=TqmeqBdjk6dsTTLj\&q=85\&s=c0319831b88e5dad2d97446e7b98be79)

* Click "+" button and select "Pivot"

### From Column Menu

![](https://mintcdn.com/exploratory-inc/TqmeqBdjk6dsTTLj/en/wrangling/images/command-pivot-column-menu.png?fit=max\&auto=format\&n=TqmeqBdjk6dsTTLj\&q=85\&s=a83fa763214eec64bdabecc6edafd9b7)

* You can also select "Pivot" from column menu of the column you want to pivot.

## Pivot

![](https://mintcdn.com/exploratory-inc/mfFUqJbgNW8Lp3uy/en/wrangling/images/pivot.png?fit=max\&auto=format\&n=mfFUqJbgNW8Lp3uy\&q=85\&s=7401c3006621744d424ea00d9719298e)

1. `Rows` - select columns for Pivot Row.
2. `Columns`  - select colums for Pivot Columns.
3. `Value` (Optional) - A column for values in output data frame.

### Parameters

* Remove NA - The default is TRUE. If NA should be removed from value.
* Fill NA with - The default is 0. This is what should be used for missing value in groups.

**Example**

*Original data:* &#x20;
<table><thead><tr><th>clarity</th>
<th>certification</th>
<th>colour</th><th>price</th></tr>
</thead><tbody><tr><td>VVS2</td><td>HRD</td>  <td>F</td><td>10796</td></tr><tr><td>VS1</td><td>GIA</td>  <td>F</td><td>1551</td></tr><tr><td>VS1</td>  <td>GIA</td>  <td>F</td>  <td>4291</td></tr>  <tr>  <td>VVS2</td>  <td>GIA</td>  <td>F</td>  <td>5881</td>  </tr>  <tr>  <td>VS2</td>  <td>GIA</td>  <td>H</td>  <td>4585</td>  </tr>  <tr>  <td>VVS2</td>  <td>GIA</td>  <td>H</td>  <td>5193</td>  </tr>  </tbody></table>

&#x20;if you set **row**: clarify, colour **columns**: certification **value**: price **fill**:0
\
&#x20; *it returns data frame with rows of combinations of clarity and colour and with columns of certification. Values are sum of price and missing values are filled by 0.*

<table><thead>  <tr>  <th>clarity\_colour</th>  <th>GIA</th>  <th>HRD</th>  </tr>  </thead><tbody>  <tr>  <td>VS1\_F</td>  <td>5842</td>  <td>0</td>  </tr>  <tr>  <td>VS2\_H</td>  <td>4585</td>  <td>0</td>  </tr>  <tr>  <td>VVS2\_F</td>  <td>5881</td>  <td>10796</td>  </tr>  <tr>  <td>VVS2\_H</td>  <td>5193</td>  <td>0</td>  </tr>  </tbody></table>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.