title: How to compute moving (or rolling, if you will) percentile/quantile for a 1d array in numpy?
body: <p>In pandas, we have <code>pd.rolling_quantile()</code>. And in numpy, we have <code>np.percentile()</code>, but I'm not sure how to do the rolling/moving version of it.</p>
  
  <p>To explain what I meant by moving/rolling percentile/quantile:</p>
  
  <p>Given array <code>[1, 5, 7, 2, 4, 6, 9, 3, 8, 10]</code>, the moving quantile <code>0.5</code> (i.e. moving percentile 50%) with window size 3 is:</p>
  
  <pre><code>1
  5 - 1 5 7 -&gt; 0.5 quantile = 5
  7 - 5 7 2 -&gt;                5
  2 - 7 2 4 -&gt;                4
  4 - 2 4 6 -&gt;                4
  6 - 4 6 9 -&gt;                6
  9 - 6 9 3 -&gt;                6
  3 - 9 3 8 -&gt;                8
  8 - 3 8 10 -&gt;               8
  10
  </code></pre>
  
  <p>So <code>[5, 5, 4, 4, 6, 6, 8, 8]</code> is the answer. To make the resulting series the same length as the input, some implementation inserts <code>NaN</code> or <code>None</code>, while <code>pandas.rolling_quantile()</code> allows to compute the first two quantile values by a smaller window.</p>