Jul-28-2018, 10:57 AM
Your
,code_and_name,approximate_elevation
0,D15A200 İNCEĞİZ AYVACA D.,"960,00 m."
1,D15A257 TUTMAÇ BAŞÖREN D.,"1379,00 m."
2,D15A014 ÇEŞME ARKI YEŞİLHİSAR Ç.,"1131,00 m."
df
has been reinitialized every time in for loop. So just put it in front of for
:df = pd.DataFrame(columns=['code_and_name', 'approximate_elevation']) for i in range(3): driver.get(str(websites['sitelist'][i])) code_and_name = driver.find_element_by_id("Span1").text approximate_elevation = driver.find_element_by_xpath( "//table[@id='Table3']/tbody/tr[3]/td[2]").text df.at[i, 'code_and_name'] = str(code_and_name) df.at[i, 'approximate_elevation'] = str(approximate_elevation)Output:
,code_and_name,approximate_elevation
0,D15A200 İNCEĞİZ AYVACA D.,"960,00 m."
1,D15A257 TUTMAÇ BAŞÖREN D.,"1379,00 m."
2,D15A014 ÇEŞME ARKI YEŞİLHİSAR Ç.,"1131,00 m."