我的查询如下:
"UPDATE " & tblMaster & " SET Reason_Code='" & strReason & "', Failure_Status='Failed', Failure_date'" & strUDate & "' WHERE Name='" & strName & "' AND date>'" & strUDate & "' AND date<'" & strLDate & "'"
查询将为每个事件更新并填充Reason_Code,Failure_Date和Failure_Status列
试图将以上查询转换为python pandas。 这是我尝试过的代码:
Master11.loc[(Master11.Name == failure.Name ) & (Master11.Date > failure.Failure_Date) & (Master11.Date < failure.Install_Date), 'Reason_Code'] = failure.Reason_Code
Master11.loc[(Master11.Name == failure.Name ) & (Master11.Date > failure.Failure_Date) & (Master11.Date < failure.Install_Date), 'Failure_Status'] = 'Failed'
Master11.loc[(Master11.Name == failure.Name ) & (Master11.Date > failure.Failure_Date) & (Master11.Date < failure.Install_Date), 'Failure_Status'] = failure.Failure_Date
ValueError:只能比较标记相同的Series对象