Answers for "merge with group by pandas"

0

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
Posted by: Guest on January-15-2021
1

two groupby pandas

In [8]: grouped = df.groupby('A')

In [9]: grouped = df.groupby(['A', 'B'])
Posted by: Guest on March-25-2020

Python Answers by Framework

Browse Popular Code Answers by Language