Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Concatenate strings using Pandas groupby

In[38]:
df.groupby(['name','month'])['text'].apply(','.join).reset_index()

Out[38]: 
    name  month         text
0  name1     11           du
1  name1     12        aj,oj
2  name2     11     fin,katt
3  name2     12  mycket,lite
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Concatenate #strings #Pandas #groupby
ADD COMMENT
Topic
Name
5+1 =