title: How do I resample/align a pandas timeseries to the closest calendar quarters?
body: <p>Simple setup    </p>
  
  <pre><code>import pandas
  from datetime import datetime
  
  v = [100, 200]
  i = [datetime(2012, 1, 31), datetime(2012, 4, 30)]
  s = pandas.Series(data=v, index=i)  
  </code></pre>
  
  <p>Here's the original timeseries:</p>
  
  <pre><code>In [11]: s
  Out[11]: 
  2012-01-31    100
  2012-04-30    200
  </code></pre>
  
  <p>And after resampling:</p>
  
  <pre><code>In [12]: s.resample('Q')
  Out[12]: 
  2012-03-31    100
  2012-06-30    200
  Freq: Q-DEC
  </code></pre>
  
  <p>So Jan/Apr got aligned to Mar/Jun.  </p>
  
  <p>Why didn't pandas choose Dec/Mar instead?</p>
  
  <p>Also, is there any way I can get it to align to Dec/Mar (which seem to be closer to the original dates) with the timeseries functions?  </p>