Pandas GroupBy 使用教程

實例 1 將分組後的字符拼接 import pandas as pd df=pd.DataFrame({ 'user_id':[1,2,1,3,3], 'content_id':[1,1,2,2,2], 'tag':['cool','nice','clever','clever','not-bad'] }) df 將df按content_id分組,然後將每組的tag用逗號拼
相關文章
相關標籤/搜索