Save scraped list object text as column to pandas dataframe

I want to scrape text from webpages and put it in to pandas dataframe. If I can scrape a table I get no problem but this here is no table and make me much trouble.

driver = webdriver.Firefox()


number = driver.find_elements_by_xpath("//span[@class='blaaal']")
name = driver.find_elements_by_xpath("//span[@class='blaaal2']")
for count in number:

for names in name:

df = pd.DataFrame(columns=['name','number'])

In that way I can print the data but if I use the count names definition without for in loop in dataframe I get error list object got no text or something like that.

I don't know how to put it to dataframe I think I have to append to define the for in loop as a column right? I don't find any post here on stack or any other learn tutorials on google.

Read more here:

Content Attribution

This content was originally published by paterson not_Gates at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: