Sometimes the question title provides the answer
Explanation\n\nWell, when I saw the word \'pivot\', I kind of knew which method to use, I just needed to pay attention to the structure of the new dataframe.\n\
## Explanation\n\nWell, when I saw the word `\'pivot\'`, I kind of knew which method to use, I just needed to pay attention to the structure of the new dataframe.\n\nSee the [pandas.DataFrame.pivot](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.pivot.html) docs:\n\n```python\n>>> df.pivot(index=\'foo\', columns=\'bar\', values=\'baz\')\n\n    bar  A   B   C\n    foo\n    one  1   2   3\n    two  4   5   6\n```\n\n## Code\n\n```pythondata []\nimport pandas as pd\n\ndef pivotTable(df: pd.DataFrame) -> pd.DataFrame:\n    return df.pivot(index=\'month\', columns=\'city\', values=\'temperature\')\n```
['Pandas']