convert pandas timedelta output from days to quarter
<p>here is my input:</p>

<pre><code> import pandas as pd
 dt_one = pd.to_datetime('2015/5/25') - pd.tseries.offsets.QuarterEnd()
 dt_two = pd.to_datetime('2016/9/15') - pd.tseries.offsets.QuarterEnd()
</code></pre>

<p>here is my output:</p>

<pre><code>(dt_two - dt_one)
Out[75]: Timedelta('457 days 00:00:00')
</code></pre>

<p>however, i desire to convert the above time delta from days in between two dates to quarters in between those two dates. How can I achieve this? The output should be '5'</p>

<p>You can calculate the number of quarters like this:</p>

<pre><code>In [106]: dt_one = pd.to_datetime('2015/5/25') - pd.tseries.offsets.QuarterEnd()
     ...: dt_two = pd.to_datetime('2016/9/15') - pd.tseries.offsets.QuarterEnd()
     ...: 

In [107]: ((dt_two.year - dt_one.year)*12 + (dt_two.month - dt_one.month))/3.0
Out[107]: 5.0
</code></pre>

python pandas timestamp datetimeindex