I would like to take a given column and use its values as (multiple) new columns in a data frame. It looks like a pivot but without index.
If I have a data frame such as:
df = pd.DataFrame({"name": [l for l in "AAABBB"], "val": np.random.random(6)})
Example data:
  name       val
0    A  0.600525
1    A  0.316421
2    A  0.744816
3    B  0.818978
4    B  0.647259
5    B  0.455111
I would like to group by the column "name" but I do not want to aggregate the results. I want to have a new column A and a new column B that contain the values in column "val".
name         A         B
0     0.600525  0.818978
1     0.316421  0.647259
2     0.744816  0.455111
The index doesn't matter here and of course, the number of values in A and B is not the same.
 
    