【发布时间】:2016-05-27 04:38:31
【问题描述】:
我有以下客户互动数据
customer interacted
c1 i1
c1 i2
c1 i1
c2 i3
c2 i1
我想将此数据框转换为另一个数据框,其中一列为客户,第二列为存储交互历史的字典。
第二个df应该像
customer interhist
c1 {'i1': 2, 'i2': 1}
c2 {'i3':1, 'i1':1}
【问题讨论】:
标签: python python-2.7 dictionary dataframe