title: Apply function to URL and write in new column in CSV
body: <p>I'm a newbie and surprised there's already not a clear answer similar to what I'm asking, apologies if this is a duplicate.</p>
  
  <p>I have a list of URLs in a CSV file I'm trying to shorten, I want to loop through my CSV file and then write a new column with the shortened URL right next to the original URL.</p>
  
  <pre><code>from pyshorteners import Shortener
  import csv
  
  def generate_short(url):
      x = shortener.short(url)
      return x
  with open('Links_Test.csv') as csvfile:
      my_date = csv.reader(csvfile, dialect = 'excel')
      for row in my_data: 
          x = shortener.short(row)
          print(X)
  </code></pre>
  
  <p>EDIT:
  I keep getting the error "ValueError: Please enter a valid url" and don't know how to proceed from here.....I'm sure I'm the problem.</p>
  
  <p>Here's what my input data looks like:</p>
  
  <pre><code>URL
  http://www.google.com
  http://www.facebook.com
  http://www.twitter.com
  http://www.linkedin.com
  </code></pre>
  
  <p>and here's what I want my output to look like:</p>
  
  <pre><code>URL                        Short_URL
  http://www.google.com      http://goo.gle
  http://www.facebook.com    http://goo.g3c
  http://www.twitter.com     http://goo.g3a
  http://www.linkedin.com    http://goo.g2q
  </code></pre>
  
  <p>Thank you for your help.  I was very surprised there's not already a clear answer posted (at least I couldn't find it) so I'm sorry if this is a duplicate.</p>