title: Extracting just Month and Year separately from Pandas Datetime column
body: <p>I have a Dataframe, df, with the following column:</p>
  
  <pre><code>df['ArrivalDate'] =
  ...
  936   2012-12-31
  938   2012-12-29
  965   2012-12-31
  966   2012-12-31
  967   2012-12-31
  968   2012-12-31
  969   2012-12-31
  970   2012-12-29
  971   2012-12-31
  972   2012-12-29
  973   2012-12-29
  ...
  </code></pre>
  
  <p>The elements of the column are pandas.tslib.Timestamp.</p>
  
  <p>I want to just include the year and month.  I thought there would be simple way to do it, but I can't figure it out.</p>
  
  <p>Here's what I've tried:</p>
  
  <pre><code>df['ArrivalDate'].resample('M', how = 'mean')
  </code></pre>
  
  <p>I got the following error:</p>
  
  <pre><code>Only valid with DatetimeIndex or PeriodIndex 
  </code></pre>
  
  <p>Then I tried:</p>
  
  <pre><code>df['ArrivalDate'].apply(lambda(x):x[:-2])
  </code></pre>
  
  <p>I got the following error:</p>
  
  <pre><code>'Timestamp' object has no attribute '__getitem__' 
  </code></pre>
  
  <p>Any suggestions?</p>
  
  <p>Edit: I sort of figured it out.  </p>
  
  <pre><code>df.index = df['ArrivalDate']
  </code></pre>
  
  <p>Then, I can resample another column using the index.</p>
  
  <p>But I'd still like a method for reconfiguring the entire column.  Any ideas?</p>