I have the following DataFrame df
value | type |
---|---|
one | 1 |
two | 2 |
three | 3 |
which I want to reshape such that the desired output would look like that
one | two | three |
---|---|---|
1 | 2 | 3 |
I used
df.pivot(columns="values", values="type")
which gave me this:
one | two | three |
---|---|---|
1 | nan | nan |
nan | 2 | nan |
nan | nan | 3 |
How can I get around the redundancies?