I have a dataframe that looks like:
df:
Source Text
Agent aa
Agent ab
Visitor ac
Agent ad
Visitor ae
Visitor ba
Visitor bb
Agent bc
Agent bd
Agent be
I would like to create a new dataframe that looks the following:
Source Text
Agent aa ab
Visitor ac
Agent ad
Visitor ae ba bb
Agent bc bd be
So, for each new instance of an agent/visitor talking I want to concatenate the text of the different things one person said in a new cell.
I've found this post, however this is too specific and I don't see how to apply this to my dataframe.