No objects to concatenate in python

–1 vote
asked Sep 13, 2017 by papa

i have a google store scrapping

from selenium import webdriver
from time import sleep
from bs4 import BeautifulSoup, Comment
import pandas as pd
driver = webdriver.PhantomJS("C:/Python/phantomjs-2.1.1-windows/bin/phantomjs.exe")
link = "https://play.google.com/store/apps/details?
id=com.supercell.clashofclans&hl=en"
driver.get(link)
# driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
Ptitle = driver.find_element_by_class_name('id-app-title').text.replace(' ', '')
print(Ptitle)
# driver.find_element_by_xpath('//*[@id="body-content"]/div/div/div[1]/div[2]/div[2]/div[1]/div[4]/button[2]/div[2]').click()

sleep(1)
driver.find_element_by_xpath(
'//*[@id="body-content"]/div/div/div[1]/div[2]/div[2]/div[1]/div[4]/button[2]/div[2]/div/div').click()
# select_newest.select_by_visible_text('Newest')
# driver.find_element_by_xpath('//*[@id="body-content"]/div/div/div[1]/div[2]/div[2]/div[1]/div[4]/button[2]/div[2]/div/div').click()
sleep(2)
# driver.find_element_by_css_selector('.review-filter.id-review-sort-filter.dropdown-menu-container').click()
driver.find_element_by_css_selector('.displayed-child').click()
# driver.find_element_by_xpath("//button[@data-dropdown-value='1']").click()
driver.execute_script("document.querySelectorAll('button.dropdown-child')[0].click()")
reviews_df = []

for i in range(1, 5):
    try:
        for elem in driver.find_elements_by_class_name('single-review'):
            rating = soup.find('div', class_='tiny-star')['aria-label'][6:7]
             title = soup.find('span', class_='review-title').get_text()
        txt = soup.find('div', class_='review-body').get_text().replace('Full Review', '')[len(title) + 1:]
        print(str(i))
        content = elem.get_attribute('outerHTML')
        soup = BeautifulSoup(content, "html.parser")
        # print(soup.prettify())
        date = soup.find('span', class_='review-date').get_text()
        print(soup.get_text())
        temp = pd.DataFrame({'Date': date, 'Rating': rating, 'Review Title': title, 'Review Text': txt}, index=[0])
        print('-' * 10)
        reviews_df.append(temp)
        # print(elem)

except:
    print('s')
driver.find_element_by_xpath(
    '//*[@id="body-content"]/div/div/div[1]/div[2]/div[2]/div[1]/div[4]/button[2]/div[2]/div/div').
click()
reviews_df = pd.concat(reviews_df,ignore_index=True)

reviews_df.to_csv(Ptitle + '_coc.csv', encoding='utf-8')

# driver.close()

but there's an error about

Traceback (most recent call last):
File "C:/Users/lobyp/Desktop/project", line 55, in <module>
reviews_df = pd.concat(reviews_df,ignore_index=True)
File
"C:\Users\lobyp\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\reshape\concat.py", line 206, in concat copy=copy)
File
"C:\Users\lobyp\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\reshape\concat.py", line 239, in init raise ValueError('No objects to concatenate') ValueError: No objects to concatenate

i dont know about "no objects to concatenate" i want solution help me please and i want add time sleep

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...