我要搜索等于id1或id2的列ID,然后在F1中添加值为col3的列。还有NAN。
d = {'id1': ["ABC","ANB","ATB","BTP"],'id2':["XXX","YYY","ZZZ","TTT"], 'Name': ["A1","A2","A3","A4"]}
F1 = pd.DataFrame(data=d)
d = {'id': ["ABC","ANB","ZZZ"], 'col3': [0,1,1]}
F2 = pd.DataFrame(data=d)
预期结果如下图所示。 enter image description here