say I have the following data without a header
0 | 1 | 2 |
---|---|---|
a | a | 1 |
a | b | 1 |
a | c | 1 |
b | a | 2 |
b | b | 2 |
b | c | 2 |
c | a | 3 |
c | b | 3 |
c | c | 3 |
I want to get the data in the following format
a | b | c | |
---|---|---|---|
a | 1 | 1 | 1 |
b | 2 | 2 | 2 |
c | 3 | 3 | 3 |
I have tried the following but didn't work out
df= df.pivot_table("2","1")
It didn't work for me but it is either wrong or it doesn't work as the df has no header. Any hint will be appreciated!