I have a bunch of URLs I am trying to write to files. I store the URLs in a pandas dataframe.
The dataframe has two columns: url and id. I am trying to request each URL from url and write it to a file named id. 
Here is what I got so far:
def get_link(url): 
    file_name = os.path.join('/mypath/foo/bar', df.id)
    try: 
        r = requests.get(url)
    except Exception as e:
        print("Failded to get " + url)
    else:
        with open(file_name, 'w') as f: 
            f.write(r.text)
df.url.apply(lambda l: get_link(l))
But when I call the function, it obvioulsly fails, since os.path.join expects a string and not a series. Hence I get the error join() argument must be str or bytes, not 'Series'
Any ideas how I can simultaenously call df.id and df.url?
Thank you/R
 
     
    