Issue
Hello Everybody can somebody help me, I'm trying to combine the result of 2 different loops in one data frame, my code is below: I will show the output and an idea of how I would like it, in advance I appreciate your help:
This my actual output
But I want something like this:
Thank you Guys Or also if there's any suggestion about my code or if I can make it simpler I'm open to suggestions thank you all
Solution
you could zip the 2 lists (im assuming lists or tuples are returned for soup.findall
) together and iterated over it once, and extract the 2 elements at the same time so you can pass that new list into a dataframe
prices_list=[]
for span1,span2 in zip(soup.findall("div", attr = {"class":"quote-rate-logo"}),soup.findall("span", attr = {"class":"quote-rate"}):
for img in span1:
#your code here
image_name = foo
prices = span.text
prices_list.append([image_name, prices])
df = pd.DataFrame(prices_list)
Answered By - Christian Trujillo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.