title: How to compute Minitab-equivalent quartiles using NumPy
body: <p>I have a homework assignment that I was doing with Minitab to find quartiles and the interquartile range of a data set. When I tried to replicate the results using NumPy, the results were different. After doing some googling, I see that there are many different algorithms for computing quartiles: <a href="http://mathworld.wolfram.com/Quartile.html" rel="nofollow" title="Quartiles">as listed here</a>. I've tried all the different types of interpolation listed in the NumPy docs for the percentile function but none of them match minitab's algorithm. Is there any lazy solution to achieve the minitab algorithm with NumPy or will I just need to roll out my own code and implement the algorithm?</p>
  
  <p>Sample code:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  terrestrial = Series([76.5,6.03,3.51,9.96,4.24,7.74,9.54,41.7,1.84,2.5,1.64])
  aquatic = Series([.27,.61,.54,.14,.63,.23,.56,.48,.16,.18])
  
  df = DataFrame({'terrestrial' : terrestrial, 'aquatic' : aquatic})
  </code></pre>
  
  <p>This is the method I used with NumPy</p>
  
  <pre><code>q75,q25 = np.percentile(df.aquatic, [75,25], interpolation='linear')
  iqr = q75 - q25
  </code></pre>
  
  <p>The results from Minitab are different:</p>
  
  <pre><code>Descriptive Statistics: aquatic, terrestrial 
  
  Variable         Q1      Q3     IQR
  aquatic      0.1750  0.5725  0.3975
  terrestrial    2.50    9.96    7.46
  </code></pre>