title: How to convert date to Year.Q fomat in DataFrame
body: <pre><code>   2000-01   2000-02   2000-03   2000 -04 ......   2016-08
  0    1010       43453      5564       45545           15555
  1    4565       44646      8989       56565           56565
  </code></pre>
  
  <p>I have a dataframe like this.I need to add some columns like "2000q1" which means the mean values of 2000-01,2000-02,2000-03. So month 4-6 is q2 ,month 7-9 is q3 ,month 10-12 is q4.
  I think the result should be like this:</p>
  
  <pre><code>2000q1       2000q2    2000q3   2000q4  2001q1......2016q3
  16675.67     15615     ...................................
  19400        55665     ...................................
  </code></pre>
  
  <p>I think the first step is to convert the columns to datetime.</p>
  
  <pre><code>import pandas as pd
  df.columns.map(pd.to_datetime)
  </code></pre>
  
  <p>But I don't know what's the next step</p>
  
  <hr>
  
  <p>I have an idea but it doesn't work.
  I use the loop.</p>
  
  <pre><code>d = []
  for i in range(2000,2017):
      i=str(i)
      d.append(i+'q'+str(1))
      d.append(i+'q'+str(2))
      d.append(i+'q'+str(3))
      d.append(i+'q'+str(4))
  #I create a list contains the date I need. Next step is put mean values in.
  d = d[:-1] #remove 2016q4 from list because the date untill 2016-08
  for date in d:
      for a in range(0,201,3):
          average = np.mean(df.iloc[:,a:a+3])
          df[date] = average   
  </code></pre>
  
  <p>But the result shows that the new columns are all NaN values.</p>