Dataframe: one two a 1 x b 1 y c 2 y d 2 z e 3 z grp = DataFrame.groupby(\'one\') grp.agg(lambda x: ???) #or equivalent function
Desired o
There is a better way to concatenate strings, in pandas documentation.So I prefer this way:
In [1]: df.groupby('one').agg(lambda x: x.str.cat(sep='|')) Out[1]: two one 1 x|y 2 y|z 3 z