我有以下数据帧:
Parameters
我的目的是将
Data = {'PO_Number': ['123456', '456789', '147258', '258369', '987654', '654321', '159548', '325498'], 'Paid_Date': [' ', ' ',' ',' ',' ',' ',' ',' '] } Data_Two = {'Journal_Number': ['123456', '456789', '147258', '258369', '987654', '654321', '159548', '325498','489526', '782389', '124895', '957832', '569553', '218945'], 'Effective_Date': ['3/1/2019', '3/2/2019', '3/3/2019', '3/4/2019', '3/5/2019', '3/6/2019', '3/7/2019', '3/8/2019','3/9/2019','3/10/2019','3/11/2019','3/12/2019','3/13/2019','3/14/2019', '3/15/2019'] }
中的PO_Number
与Data
中的Journal_Number
如果存在Data_Two
,则将PO_Number
的值拉到Effective_Date
我尝试使用的代码如下:
Paid_Date
并调用我使用的函数:
def eff_date(x):
if Date['PO_Number'] in Data_Two['Journal_Number'] :
return Data_Two['Effective_Date']
else:
'Unkown'
但我一直收到此错误:
Data.apply(eff_date, Data['Paid_Date'])
任何帮助将不胜感激