I have a Pandas Dataframe as follows:
   user   start  end  label    item
0   1      0    3     food     burger
1   1      4    6     food     cola
0   2      0    3     drink    burger   
1   2      4    6     food     cola
0   3      0    3     food     burger
1   3      7    9     drink    fries  
I would like to "re-structure" the matrix so that label-values that share the same values in the columns "start" and "end" are moved to separate columns instead. For the matrix above, I'd like to get the matrix:
      start  end    item   label1  label2  label3
0       0    3      burger  food    drink   food   
1       4    6      cola    food    food    nan  
2       7    9      burger  nan     nan     drink 
Does anyone have any idea how to solve this?
 
    