[英]Update pandas dataframe column with another column in another dataframe on index overlap
I wish to update column A in dfA with column B in dfB on index overlap我希望在索引重叠时用 dfB 中的 B 列更新 dfA 中的 A 列
dfA自由度
A
1 1
2 1
3 1
4 1
dfB东风
B
3 2
4 2
5 2
6 2
Desired result:期望的结果:
A
1 1
2 1
3 2
4 2
What is the simplest way to do this?最简单的方法是什么?
Try with update
尝试update
dfA.update(dfB.rename(columns = {'B':'A'}))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.