troubleshooting Question

Python Selenium and Pandas question

Avatar of Hiro 714
Hiro 714 asked on
SeleniumPython
10 Comments6 Solutions24 ViewsLast Modified:
When I append, only original df_data appears and unable to append df_data1.
Please advise.

Ticket_List = []
Ticket_Titles = driver.find_elements_by_xpath('//tbody/tr/td[2]/a')
Ticket_Discriptions = driver.find_elements_by_xpath('//tbody/tr/td[3]/a')
Ticket_Status = driver.find_elements_by_xpath('//tbody/tr/td[4]/a')
Ticket_Titles = Ticket_Titles[4:]
Ticket_List = []
for i in range(len(Ticket_Titles)):
    temporary_data={'Number': Ticket_Titles[i].text,
                   'Titles': Ticket_Discriptions[i].text,
                   'Status': Ticket_Status[i].text
                   }
    Ticket_List.append(temporary_data)
   
df_data = pd.DataFrame.from_dict(Ticket_List)
df_data.dtypes
print(df_data)

Open in new window

Ticket_Titles1 = driver.find_elements_by_xpath('//tbody/tr/td[2]/a')
Ticket_Discriptions1 = driver.find_elements_by_xpath('//tbody/tr/td[3]/a')
Ticket_Status1 = driver.find_elements_by_xpath('//tbody/tr/td[4]/a')

Ticket_Titles1 = Ticket_Titles1[4:]

Ticket_Titles.extend(Ticket_Titles1)
Ticket_Discriptions.extend(Ticket_Discriptions1)
Ticket_Status.extend(Ticket_Status1)

Open in new window

Ticket_List1 = []
for i in range(len(Ticket_Titles1)):
    temporary_data1={'Number': Ticket_Titles1[i].text,
                   'Titles': Ticket_Discriptions1[i].text,
                   'Status': Ticket_Status1[i].text
                   }
    Ticket_List1.append(temporary_data1)
   
df_data1 = pd.DataFrame.from_dict(Ticket_List1)

Open in new window

df_data.append(df_data1)

Open in new window


ASKER CERTIFIED SOLUTION
David H.H.Lee
Digital Marketing (Hospitality)
Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 6 Answers and 10 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 6 Answers and 10 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004