I have a table in pandas dataframe like below.
Word Term Score
0 X A 1
1 X B 2
2 X C 3
3 Y A 4
4 Y B 5
5 Y C 6
I want to reshape it such that only the TERM column is transposed and values in Score column are shown under them like below:
Word A B C
X 1 2 3
Y 4 5 6
I tried transpose and pivot but neither worked to fulfill my needs.
df.pivot(index='Word', columns='Term', values='Score')
pivot
generated an error that the index contained duplicate entries and cannot reshape
raise ValueError('Index contains duplicate entries, ' ValueError: Index contains duplicate entries, cannot reshape