Pivot DataFrame
IntuitionPivoting transforms the data into a more readable format by reorganizing rows and columns. It helps compare values across specific categories effective
# **Intuition**  
Pivoting transforms the data into a more readable format by reorganizing rows and columns. It helps compare values across specific categories effectively.  

# **Approach**  
1. Use `pandas.pivot()` to reorganize the data:
   - Set `month` as the index to represent each row.
   - Use `city` as columns to create separate columns for each city.
   - Populate the table with `temperature` values.
2. Return the pivoted DataFrame.  

# **Complexity**  
- **Time Complexity**: $$O(n)$$, where \(n\) is the number of rows in the original DataFrame.  
- **Space Complexity**: $$O(n)$$, as a new DataFrame is created to store the pivoted data.  

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

def pivotTable(weather: pd.DataFrame) -> pd.DataFrame:
    pivotdf=weather.pivot(index='month', columns='city', values='temperature')
    return pivotdf
data = {
    "city": ["Jacksonville", "Jacksonville", "Jacksonville", "Jacksonville", "Jacksonville", 
             "ElPaso", "ElPaso", "ElPaso", "ElPaso", "ElPaso"],
    "month": ["January", "February", "March", "April", "May", 
              "January", "February", "March", "April", "May"],
    "temperature": [13, 23, 38, 5, 34, 20, 6, 26, 2, 43]
}
df=pd.DataFrame(data)
result=pivotTable(df)
print(df)
```
['Pandas']