title: How to convert Python date format '%B - %Y' back to '%Y-%m-%d'?
body: <p>I'm working with a data frame containing dates in the '%B - %Y' format and need to convert them back to a datetime '%Y-%m-%d' format in order to make date calculations. </p>
  
  <p>For example, I'd like to convert <code>old_date = 'July - 2016'</code> to a new date variable <code>new_date = '2016-07-15'</code>, where it's OK to use an arbitrary value (here the 15th of the month) for the day.</p>
  
  <p>My first pass at the problem, which returned <code>TypeError: unsupported operand type(s) for -: 'str' and 'str'</code>:</p>
  
  <pre><code>from datetime import datetime
  df['new_date'] = datetime.strptime(str(df['old_date']), '%Y-%m-15')
  </code></pre>