我有看起來像這樣的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
提交
取消