✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
What will be the output of the following code?
import pandas as pd
data = {'Category': ['A', 'A', 'B', 'B', 'C'], 'Subcategory': ['X', 'Y', 'X', 'Y', 'X'], 'Value': [10, 20, 30, 40, 50]}
df = pd.DataFrame(data)
result = df.pivot(index='Category', columns='Subcategory', values='Value')
print(result)
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!