【发布时间】:2020-03-24 10:18:37
【问题描述】:
我想做一个对列表产生刺激的代码,并在 SOQL 查询中使用它来获取输出并附加到 excel 表中。
这是我的代码,有没有更简洁的方法可以做到这一点。
ExlReport=pd.read_excel(ExlReportPath,sheet_name=ExlSheetName)
CaseNumberList = [] IdList = [] IdList = ExlReport['Id']
for Id in IdList:
results = sf.query_all ("SELECT LastModifiedDate,Case,Id FROM Case_Note WHERE Case = '%s' ORDER BY LastModifiedDate ASC" %
soqlEscape(Id)) sf_df =
pd.DataFrame(results['records']).drop(columns='attributes')
预期输出:
LastModifiedDate Case Id
0 2020-02-19T23:31:35.000+0000 xxxxxxxxxxxx yyyyyyyyyyyy
1 2020-02-19T23:31:43.000+0000 xxxxxxxxxxxx yyyyyyyyyyyy
2 2020-03-11T20:48:54.000+0000 xxxxxxxxxxxx yyyyyyyyyyyy
我得到的输出:
0 2020-02-19T23:31:35.000+0000 xxxxxxxxxxxx yyyyyyyyyyyy
1 2020-02-19T23:31:43.000+0000 xxxxxxxxxxxx yyyyyyyyyyyy
2 2020-03-11T20:48:54.000+0000 xxxxxxxxxxxx yyyyyyyyyyyy
new_axis = axis.drop(labels, errors=errors)
File "C:\xxxxxxx", line 5018, in drop
raise KeyError(f"{labels[mask]} not found in axis")
KeyError: "['attributes'] not found in axis"
【问题讨论】:
标签: python pandas salesforce soql