合并相同属性值(groupby)
df = pd.DataFrame(data={'name':['zs', 'li', 'a', 'zs'], 'value': [2, 4, 5, 6]})
a = df.groupby('name')['value'].sum() # 得到的结果是series
# 将series转成DataFrame
b = a.to_frame() # 将单个series转成DataFrame
b.reset_index(inplace=True) # 将index 变成列
标签:index,常用,name,df,series,DataFrame,操作,zs
From: https://www.cnblogs.com/yimeimanong/p/17097819.html