Reputation: 17
I have the following code:
IN:
from googlesearch import search
query_list = ["Linkedin","Facebook","Instagram", "site oficial"]
company_name = input("Please provide the stock name:")
for j in query_list:
for i in search(company_name+j, tld='com.br', lang='pt-br', num=1, start=0, stop=1,
pause=1.0):
print (i)
OUT:
https://br.linkedin.com/company/havanoficial
https://www.facebook.com/Havanoficial/
https://www.instagram.com/havanoficial/
https://www.havan.com.br/
The problem is that I need these results in a DataFrame with 4 different columns. My desired output would be something like this:
Website | |||
---|---|---|---|
https://br.linkedin.com/company/havanoficial | https://www.facebook.com/Havanoficial/ | https://www.instagram.com/havanoficial/ | https://www.havan.com.br/ |
Any tips? I really appreciate it! :D
Upvotes: 0
Views: 181
Reputation: 169444
You can do the following:
out = [
'https://br.linkedin.com/company/havanoficial/',
'https://www.facebook.com/Havanoficial/',
'https://www.instagram.com/havanoficial/',
'https://www.havan.com.br/',
]
df = pd.DataFrame(out)
df = df.T
df.columns = query_list
Result:
In [38]: df
Out[38]:
Linkedin Facebook Instagram site oficial
0 https://br.linkedin.com/company/havanoficial https://www.facebook.com/Havanoficial/ https://www.instagram.com/havanoficial/ https://www.havan.com.br/
Upvotes: 1