我有看起来像这样的df:id123我需要遍历数据帧(在df帧中只有1列),并将每个ID传递到API,在其中&leadId=等号后说。IE&leadId=1我一直在尝试这段代码:lst = []for index,row in df.iterrows(): url = 'https://url.com/path/to?username=string&password=string&leadId=index' xml_data1 = requests.get(url).text lst.append(xml_data1) print(xml_data1)但我得到错误:System.ArgumentException: Cannot convert index to System.Int32.我没有在索引中将索引值传递到api中的参数,这是怎么做的呢?我也尝试将行传递到API中并得到相同的错误。先感谢您。编辑:通过以下代码行将dataframe转换为int:df = df.astype(int)更改为以下行,而不是API参数中的索引。 for index,row in df.iterrows(): url = 'https://url.com/path/to?username=string&password=string&leadId=row' xml_data1 = requests.get(url).text lst.append(xml_data1) print(xml_data1)得到同样的错误。
添加回答
举报
0/150
提交
取消