I have df that looks like this:
ref      text   id     
a        zz     12eia
a        yy     radf02
b        aa     a8adf
b        bb     2022a
I am trying to rotate this dataframe to look like below with values in column ref becoming column names and values in text becoming values under those columns and I dont need the 'id' column :
a     b     
zz    aa
yy    bb 
I tried using this line, but I am not getting the result, without adding the id column:
df_rotated = df.pivot_table(index='ref', values='text', columns='id', aggfunc='first')
The data collapses and is not the result I want, what am I doing wrong?
 
    