我有两个数据帧,即high\u scores1和high\u scores2,如下所示:
match_id inn1 batting_team bowling_team runs1
1 1 KKR RCB 222
2 1 CSK KXIP 240
3 1 RR DD 129
4 1 MI RCB 165
match_id inn2 batting_team bowling_team runs2
1 2 RCB KKR 82
2 2 KXIP CSK 207
3 2 DD RR 132
4 2 RCB MI 166
现在,我需要使用列match_id合并这两个数据帧,以便新的数据帧如下所示:
^{pr2}$我尝试了以下代码:
high_scores1[['match_id','inn1','batting_team','bowling_team','runs1']].merge(high_scores2, left_on = 'match_id', right_on = 'match_id', how = 'left')
但它没有起作用。如何合并数据帧?在
只需使用
演示
^{pr2}$你需要
相关问题 更多 >
编程相关推荐