Hiro 714
asked on
Python Selenium and Pandas question
When I append, only original df_data appears and unable to append df_data1.
Please advise.
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)
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)
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)
df_data.append(df_data1)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you.
I tried
I tried
df_data=df_data.append(df_data1)
and I get this index. why this is not in order?SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you.
I have tried.
I have tried.
df_data.sort_index()
How do I re-index?ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sorry, i thought that is the number of a row number
ASKER