# pivot() Method: Pivot DataFrame Without Aggregation Operation

- November 24, 2018 • 17 min read
- Key Terms: pivot, python, pandas

In pandas, we can pivot our DataFrame without applying an aggregate operation. This pivot is helpful to see our data in a different way - often turning a format with many rows that would require scrolling into a new format with fewer rows but perhaps more columns.

### Import Module¶

```
import pandas as pd
```

### Example: Pivot Tesla Car Acceleration Details¶

Here is fictional acceleration tests for three popular Tesla car models. In order to verify acceleration of the cars, I figured a third-party may make three *runs* to test the three models alongside one another.

```
s = 'Tesla Model S P100D'
x = 'Tesla Model X P100D'
three = 'Tesla Model 3 AWD Dual Motor'
models = [s, x, three]*3
dates = ['Sept 1 9am']*3 + ['Sept 1 10am']*3 + ['Sept 1 11am']*3
acceleration_times = [2.5, 2.92, 3.33, 2.51, 2.91, 3.31, 2.51, 2.92, 3.3]
data = {'car_model': models,
'date': dates,
'0-60mph_in_seconds': acceleration_times}
df = pd.DataFrame(data)
df
```

I want to pivot this data so each row is a unique car model, the columns are dates and the values in the table are the acceleration speeds.

```
df.pivot(index='car_model', columns='date', values='0-60mph_in_seconds')
```

This format may be easier to read so you can easily focus your attention on just the acceleration times for the 3 models.

You can read more about pandas `pivot()`

on the official documentation page.