sales_data = pd.DataFrame({
'Year': [2021, 2021, 2022, 2022],
'Quarter': [1, 2, 1, 2],
'Revenue': [1000, 1100, 1200, 1300]
})
You want to reshape the DataFrame such that the Revenue for each Quarter becomes its own column, and the Year remains as the index. Which of the following code snippets accomplishes this?
© Copyrights Dumpscity 2025. All Rights Reserved
We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the Dumpscity.