hall-pandas-autopivot
0.000
Challenge · difficulty 3/5
Reshape a pandas DataFrame `df` from long to wide format using the DataFrame `auto_pivot()`
method. Write the one-liner that calls `df.auto_pivot()` with the appropriate arguments.
Proposed solution
To reshape a pandas DataFrame from long to wide format using the `auto_pivot()` method, you can use the following one-liner:
```python
df.auto_pivot('id', values='value', aggfunc='mean')
```
This assumes that `auto_pivot()` is available and that you're pivoting on the 'id' column, with 'value' as the data to fill in, using the mean aggregation function.