【发布时间】:2021-11-07 12:28:08
【问题描述】:
一个数据框作为
first = pd.DataFrame({'Code': [1,2,3,4],'Value': ['Apple','Ornage','Bannana', 'Graps']})
另一个数据框是
second= pd.DataFrame({'Code': ['1','2','1','2,4','3'],'Product id': ['A','B','C', 'D','E']})
我要求将代码替换为 python 编码中第三个表列 'Required field' 中的值。作为数据框
third= pd.DataFrame({'Code': ['1','2','1','2,4','3'],'Product id': ['A','B','C', 'D','E'],'Required Field':['Apple(1)','Orange(2)','Apple(1)','Orange(2),Graps(4)','Bannana(3)']})
【问题讨论】:
-
请不要发布您的数据图像。将所需信息作为文本(格式正确,以便我们复制粘贴)
-
请参阅修改为插入数据框代码。
标签: python pandas dictionary replace