Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas group by concat

In [124]:

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

Out[124]:
    name  month         text
0  name1     11       hej,du
1  name1     12        aj,oj
2  name2     11     fin,katt
3  name2     12  mycket,lite
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #group #concat
ADD COMMENT
Topic
Name
6+4 =