title: python pandas extract year from datetime: df['year'] = df['date'].year is not working
body: <p>I import a dataframe via <code>read_csv</code>, but for some reason can't extract the year or month from the series <code>df['date']</code>, trying that gives <code>AttributeError: 'Series' object has no attribute 'year'</code>:</p>
  <pre><code>date    Count
  6/30/2010   525
  7/30/2010   136
  8/31/2010   125
  9/30/2010   84
  10/29/2010  4469
  
  df = pd.read_csv('sample_data.csv', parse_dates=True)
  
  df['date'] = pd.to_datetime(df['date'])
  
  df['year'] = df['date'].year
  df['month'] = df['date'].month
  </code></pre>
  <p>UPDATE:
  and when I try solutions with <code>df['date'].dt</code> on my pandas version 0.14.1, I get   &quot;AttributeError: 'Series' object has no attribute 'dt' &quot;:</p>
  <pre><code>df = pd.read_csv('sample_data.csv',parse_dates=True)
  
  df['date'] = pd.to_datetime(df['date'])
  
  df['year'] = df['date'].dt.year
  df['month'] = df['date'].dt.month
  </code></pre>
  <p>Sorry for this question that seems repetitive - I expect the answer will make me feel like a bonehead... but I have not had any luck using answers to the similar questions on SO.</p>
  <hr />
  <p>FOLLOWUP: I can't seem to update my pandas 0.14.1 to a newer release in my Anaconda environment, each of the attempts below generates an invalid syntax error. I'm using Python 3.4.1 64bit.</p>
  <pre><code>conda update pandas
  
  conda install pandas==0.15.2
  
  conda install -f pandas
  </code></pre>
  <p>Any ideas?</p>