可以这样说:
df1
IMG \ isHotDogConfidence
img1 1=0
Img2\x{e76f}
Img3\x{e76f}0
img4 4_x_0
img5 5-1
df2
IMG \ isHotDogConfidence
img1 1/1
Img2\x{e76f}
Img3\x{e76f}
img4 4_x_0
img5 5\x{e76f}
我想要的:
IMG \ isHotDogConfidence
img1 1\x{e76f} 0.5
Img2\x{e76f}
img3 3\x{e76f} 0.5
img4 4_x_0
img5 5= 0.5
你将如何利用熊猫来有效地完成这个任务?
发布于 2019-10-23 07:46:29
将concat与聚合mean结合使用
df = pd.concat([df1, df2]).groupby('IMG', as_index=False).mean()
print (df)
IMG isHotDogConfidence
0 img1 0.5
1 img2 1.0
2 img3 0.5
3 img4 0.0
4 img5 0.5https://stackoverflow.com/questions/58517828
复制相似问题