热线电话:13121318867

登录
2021-03-31 阅读量: 1167
python如何实现两列中行数据相同的次数统计

python如何实现两列中行数据相同的次数统计

解决:

import pandas as pd    
data = pd.read_excel('c:/users/用户/desktop/数据.xlsx')    
temp = [[name[0],name[1],len(group)] for name,group in data.groupby(['Origin','Destination'])]    
data_re = pd.DataFrame(temp,columns=['Origin','Destination','count'])


0.0000
0
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子