我一直在编写代码,并得到预期的预期块错误。你能帮我一下为什么不能用吗?
错误行:
qr_os = qr_os.append(qr2.iloc[i],ignore_index=True)代码:
d = qr2.iloc[0].to_dict()
for i in list(d.keys()): d[i] = np.nan
for i in range(len(qr2)):
if qr2.iloc[i]['PrimaryRiskId'] not in list(aID):
if qr2.iloc[i]['LinkageLinkType'] != 'B2B_COUNTER_TRADE':
if qr2.iloc[i]['CreatedBy'] != 'koala_manual'\
and qr2.iloc[i]['Book'] not in {'PIZH','SIBZ','IIBZ','OTCL','FXNG'}\
and qr2.iloc[i]['SubCategoryValuation'] not in {'EQCertificate','EQCertificatePlus','EQCappucino','EQCliquetUnlimitedDownside'}:
qr_rec = qr_rec.append(qr2.iloc[i],ignore_index=True)
d[list(d.keys())[0]] = 'records which are in cleaned QueryResults and are not in TMRActivity'
qr_rec = qr_rec.append(d,ignore_index=True)
#### QueryResults exceptions which are out of scope###
qr_os = qr2.iloc[[0,1]]
for i in range(len(qr2)):
if qr2.iloc[i]['PrimaryRiskId'] not in list(aID):
if qr2.iloc[i]['LinkageLinkType'] == 'B2B_COUNTER_TRADE':
if qr2.iloc[i]['CreatedBy'] == 'koala_manual'\
and qr2.iloc[i]['Book'] in {'PIZH','SIBZ','IIBZ','OTCL','FXNG'}\
and qr2.iloc[i]['SubCategoryValuation'] in {'EQCertificate','EQCertificatePlus','EQCappucino','EQCliquetUnlimitedDownside'}:
qr_os = qr_os.append(qr2.iloc[i],ignore_index=True)
d[list(d.keys())[0]] = 'records which are in cleaned QueryResults and are not in TMRActivity and should be treated as o/s'
qr_os = qr_os.append(d,ignore_index=True)发布于 2022-06-21 07:32:46
查看您的代码:
if qr2.iloc[i]['CreatedBy'] == 'koala_manual'\
and qr2.iloc[i]['Book'] in {'PIZH','SIBZ','IIBZ','OTCL','FXNG'}\
and qr2.iloc[i]['SubCategoryValuation'] in {'EQCertificate','EQCertificatePlus','EQCappucino','EQCliquetUnlimitedDownside'}:
qr_os = qr_os.append(qr2.iloc[i],ignore_index=True)线
if qr2.iloc[i]['CreatedBy'] == 'koala_manual'\在缩进级别与
qr_os = qr_os.append(qr2.iloc[i],ignore_index=True)所以问题肯定在那里。
https://stackoverflow.com/questions/72696813
复制相似问题