I have this following dataframe:
Status Percentage Value Name Tahun
0 X 66.666667 4.0 A 2021
1 Y 33.333333 2.0 A 2021
2 Z 0.000000 0.0 A 2021
0 X 25.000000 2.0 A 2020
1 Y 62.500000 5.0 A 2020
2 Z 12.500000 1.0 A 2020
I want to transpose the dataframe and change the column header to Status
values. Ideally the output should look like
X Y Z Type Name Tahun
66.666667 33.333333 0.000000 Percentage A 2021
4.0 2.0 0.0 Value A 2021
25.000000 62.500000 12.500000 Percentage A 2020
2.0 5.0 1.0 Value A 2020
I tried this one:
df = df.set_index('Status').T
but I didnt get output as my expected. How can I change the rest of column names?