pandas 分组 合并多个元素

res.groupby(['customer_id'])['project_name'].apply(lambda x:', '.join(x)).reset_index()

x.groupby(['sa'])['daList'].apply(lambda x:np.concatenate(list(x))).reset_index()
Out[340]: 
   sa            daList
0   2            [2, 3]
1   3         [4, 5, 9]
2   5  [44, 55, 23, 45]
3   7              [66]
————————————————
原文链接:https://blog.csdn.net/u011012422/article/details/82773618
原文地址:https://www.cnblogs.com/cupleo/p/12269712.html