title: Pandas - converting datetime64 to Period
body: <p>I have a Series of dates in datetime64 format.</p>
  
  <p>I want to convert them to a series of Period with a monthly frequency. (Essentially, I want to group dates into months for analytical purposes). </p>
  
  <p>There must be a way of doing this - I just cannot find it quickly.</p>
  
  <p>Note: these dates are not the index of the data frame - they are just a column of data in the data frame.</p>
  
  <p>Example input data (as a Series)</p>
  
  <pre><code>data = pd.to_datetime(pd.Series(['2014-10-01', '2014-10-01', '2014-10-31', '2014-11-15', '2014-11-30', np.NaN, '2014-12-01']))
  print (data)
  </code></pre>
  
  <p>My current kludge/work around looks like</p>
  
  <pre><code>data = pd.to_datetime(pd.Series(['2014-10-01', '2014-10-01', '2014-10-31', '2014-11-15', '2014-11-30', np.NaN, '2014-01-01']))
  data = pd.DatetimeIndex(data).to_period('M')
  data = pd.Series(data.year).astype('str') + '-' +  pd.Series((data.month).astype('int')).map('{:0&gt;2d}'.format)
  data = data.where(data != '2262-04', other='No Date')
  print (data)
  </code></pre>