title: Python Change String(date) format of specific column in csv file
body: <p>I'm trying to convert the value of a column named <code>date</code> in my csv file to another format, for instance:</p>
  <h3>Original records</h3>
  <pre><code>transfer id,player id,player name,season,date
  732058,1126,,12/13,Jul 1- 2012
  581951,1126,,11/12,Jun 3- 2011
  295000,1126,,09/10,Aug 12- 2009
  98459,1126,,06/07,Nov 6- 2006
  7267,1126,,03/04,Jul 2- 2003
  ...
  </code></pre>
  <p>and I'd like to get a result like</p>
  <pre><code>transfer id,player id,player name,season,date
  732058,1126,,12/13,2012-07-01
  581951,1126,,11/12,2011-06-03
  295000,1126,,09/10,2009-08-12
  98459,1126,,06/07,2006-11-06
  7267,1126,,03/04,2003-07-02
  ...
  </code></pre>
  <p>as the data stored in csv file are string, I have written a method which can convert the date format:</p>
  <pre><code>import time
  
  # convert date from original format to new format
  def date_convert(_date,fmt_original,fmt_new):
      if date_validate(_date,fmt_original):
          timeArray=time.strptime(_date,fmt_original)
          return time.strftime(fmt_new,timeArray)
      else:
          return '0001-01-01'
  
  def date_validate(_date,fmt_original):
      try:
          time.strptime(_date, fmt_original)
          return True
      except ValueError:
          return False
  </code></pre>
  <p>then I try to change the date in csv file,and I try to utilize <code>pandas</code>, as is told by <a href="https://stackoverflow.com/a/37456887/6653189">@MaxU</a>:</p>
  <p>and I write a code like</p>
  <pre><code>import pandas as pd
  import date_format
  
  df=pd.read_csv('the_transfer_info_test.csv',delimiter=',')
  df.date=date_format.date_convert(df.date, '%b %d- %Y', '%Y-%m-%d')
  print df
  </code></pre>
  <p>and at first I got an exception like this:</p>
  <pre><code>TypeError: expected string or buffer
  </code></pre>
  <p>I thought it may be related to the data type,as the df.date get a type of Series in pandas, so I coded as</p>
  <pre><code>df.date=date_format.date_convert(str(df.date), '%b %d- %Y', '%Y-%m-%d')
  </code></pre>
  <p>but it returns all <code>0001-01-01</code> which is the exception date in date_format, therefore I searched how to convert the Series to String and find an answer like
  <a href="https://stackoverflow.com/a/22231860/6653189">@Amit</a>, and I tried methods below:</p>
  <pre><code>df['date'].astype(basestring)
  df.date.apply(str)
  df['date'].astype(str)
  df['date'].astype('str')
  </code></pre>
  <p>but they don't work for me, I got the same exception like:</p>
  <pre><code>TypeError: expected string or buffer
  </code></pre>
  <p>I wonder how I can convert specific column values in csv file,either utilize pandas or not.</p>
  <p><strong>BTW, my python version is 2.7.12 with IDE PyCharm and Anoconda 4.0.0 and pandas 0.18.0.</strong></p>
  <p>Any help is appreciated,thank you.</p>
  <hr />
  <p>Thanks to @jezrael, for my sample above it both work well, it's my fault that I meant to simplify my issue and simplified my question,actually my original data is like:</p>
  <pre><code>transfer id,player id,player name,season,date,move from,move from id,move to,move to id,market value,transfer fee
  732058,1126,,12/13,Jul 1- 2012,e-frankfurt,24,1-fc-koln,3,£1.06m,Free transfer
  581951,1126,,11/12,Jul 1- 2011,fc-st-pauli,35,eintracht-frankfurt,24,£1.70m,£425k
  295000,1126,,09/10,Jul 1- 2009,alem-aachen,8,fc-st-pauli,35,£850k,Free transfer
  98459,1126,,06/07,Jul 1- 2006,1860-munich,72,alemannia-aachen,8,£1.36m,£765k
  7267,1126,,03/04,Jul 1- 2003,stuttgart-ii,102,tsv-1860-munich,72,-,£21k
  ...
  </code></pre>
  <p>and actually these approaches work well with <strong>part of my data</strong> I mean if I test it with afew lines with the same format,but when it comes to the original data which is about 40000 records,it's wired that those approaches do not work any more, for <code>to_datetime</code> method,I got an exception like</p>
  <pre><code>ValueError: time data '-' does not match format '%b %d- %Y' (match)
  </code></pre>
  <p>while with the second method as <code>parse_dates</code>, the date format remains the same like <code>Jun 11- 2016</code>.</p>
  <p>Again,any help will be appreciated.</p>