🚀1-row solution that beats 99999999,99%🚀
ApproachTo solve this problem I read the pandas.pivot documentationMain parameters:

data
Dataframe


columns
str or a list of str
Column to use to make new fra
# Approach

To solve this problem I read the pandas.pivot documentation

Main parameters:
- data
Dataframe

- columns
str or a list of str
Column to use to make new frame’s columns.

- index
str or a list of str, optional
Column to use to make new frame’s index. If not given, uses existing index.

- values
str or a list of the previous, optional
Column(s) to use for populating new frame’s values. If not specified, all remaining columns will be used

If u want to modify values by using some mathematical functions use pivot_table with the same parameters and **aggfunc** parameter


Goodbye, my friends!
<3

![image.png](https://assets.leetcode.com/users/images/a0aede11-e654-487d-9e7a-2c73a6f7631d_1736966469.6425095.png)



# Code
```pythondata []
import pandas as pd

def pivotTable(weather: pd.DataFrame) -> pd.DataFrame:
    return weather.pivot(index = 'month', columns = 'city', values = 'temperature')
```
['Pandas']