ฉันรู้ว่าข้อผิดพลาดนี้เป็นเรื่องปกติ ฉันลองวิธีแก้ปัญหาบางอย่างแล้วค้นหาแล้ว แต่ก็ยังไม่เข้าใจว่ามีอะไรผิดปกติ ฉันเดาว่ามันเป็นเพราะรูปแบบที่ไม่แน่นอนของ row และ row1 แต่ฉันคิดไม่ออก
ฉันกำลังพยายามทำอะไร? ฉันมี 2 ดาต้าเฟรม ฉันต้องวนซ้ำแถวของ 1 แถวแรก และสำหรับแต่ละบรรทัดของแถวแรก ให้วนซ้ำแถวที่สองและตรวจสอบค่าของเซลล์สำหรับบางคอลัมน์ รหัสของฉันและความพยายามที่แตกต่างกัน:
a=0
b=0
for row in Correction.iterrows():
b+=1
for row1 in dataframe.iterrows():
c+=1
a=0
print('Handling correction '+str(b)+' and deal '+str(c))
if (Correction.loc[row,['BO Branch Code']]==dataframe.loc[row1,['wings Branch']] and Correction.loc[row,['Profit Center']]==dataframe.loc[row1,['Profit Center']] and Correction.loc[row,['Back Office']]==dataframe.loc[row1,['Back Office']]
and Correction.loc[row,['BO System Code']]==dataframe.loc[row1,['BO System Code']]):
ฉันยังพยายาม
a=0
b=0
for row in Correction.iterrows():
b+=1
for row1 in dataframe.iterrows():
c+=1
a=0
print('Handling correction '+str(b)+' and deal '+str(c))
if (Correction[row]['BO Branch Code']==dataframe[row1]['wings Branch'] and Correction[row]['Profit Center']==dataframe[row1]['Profit Center'] and Correction[row]['Back Office']==dataframe[row1]['Back Office']
and Correction[row]['BO System Code']==dataframe[row1]['BO System Code']):
และ
a=0
b=0
for row in Correction.iterrows():
b+=1
for row1 in dataframe.iterrows():
c+=1
a=0
print('Handling correction '+str(b)+' and deal '+str(c))
if (Correction.loc[row,['BO Branch Code']]==dataframe[row1,['wings Branch']] and Correction[row,['Profit Center']]==dataframe[row1,['Profit Center']] and Correction[row,['Back Office']]==dataframe[row1,['Back Office']]
and Correction[row,['BO System Code']]==dataframe[row1,['BO System Code']]):