I'm trying to transform a dataframe similar to the one below:
index apple
1 [(red,3),(green,2)]
1 [(red,3)]
1 [(yellow,9),(red,3)]
1 [(green,2),(yellow,9)]
1 [(green,2),(yellow,9), (pink,50)]
2 [(yellow,14),(red,1)]
2 [(green,5)]
into this:
index apple_red apple_green apple_yellow apple_pink
1 3 2 9 50
2 1 5 14 0
Note that tuples are unique per index in the original table Any idea how do to this ?
Thanks