I got a simple dataframe. It basically looks like this - only much larger.
import pandas as pd
csv = [{"name" : "Peters Company", "Apples" : 1}, {"name" : "Quagmires Company", "Apples" : 0}]
df = pd.DataFrame(csv)
I trying to apply a little function I wrote to the name column. Here is what I do:
from google import search
def get_url(query):
url = search(query, tld='com', num=1, stop=0, pause=10)
print(next(url))
I am using google to search for a certain query and print it afterwords.
I am trying to create a new column url which contains the result of get_url row by row.
Here is what I did:
for i in df.name:
get_url(i)
Obviously, this only results in the urlgetting printed one by one. But I trying to expand the dataframe. I tried my luck with itterows and df.locbut so far it didn't work out. Any ideas? Thanks