I have a data frame I read from an Excel file with merged cells. The data frame looks like this:
wish to reshape the data frame from long to wide to be like this: Reshape required structure
I am using pivot as the following code:
df1 = df.pivot_table(
values='Answers',
index=['Date', 'ID'],
columns='Questions'
)
# Formatting.
df1.reset_index(inplace=True)
df1.columns.name = None
But the data frame after the pivot shows only the first column as the following image: Data frame after pivot
Any idea why?