I have a dataframe like this:
import pandas
df=pandas.DataFrame([['a','b'],['a','c'],['b','c'],['b','d'],['c','f']],columns=['id','key'])
print(df)
id key
0 a b
1 a c
2 b c
3 b d
4 c f
the result that I wanted:
id key
0 a b,c
1 b c,d
2 c f
I try use pivot function, but I don't get the result. The cast packages in R seems to tackle the problem. Thanks!