Popular recipes tagged "running"http://code.activestate.com/recipes/tags/running/popular/2013-03-06T17:33:32-08:00ActiveState Code RecipesRunning median, mean and mode (Python) 2013-03-06T17:33:32-08:00Virgil Stokeshttp://code.activestate.com/recipes/users/4183795/http://code.activestate.com/recipes/578480-running-median-mean-and-mode/ <p style="color: grey"> Python recipe 578480 by <a href="/recipes/users/4183795/">Virgil Stokes</a> (<a href="/recipes/tags/mean/">mean</a>, <a href="/recipes/tags/median/">median</a>, <a href="/recipes/tags/mode/">mode</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/running/">running</a>). </p> <p>The following is a small contribution that I hope can be useful to Python programmers for the calculation of the running median, mean and mode. It is important to note that all the "running" calculations are done for full windows. Here is a simple example:</p> <p>y = [1, 2, 3, 3, 1, 4], with a sliding window of size = 3 for the running estimations, means = 2, 2.6667, 2.3333, 2.6667 medians = 2, 3, 3, 3 modes = 1, 3, 3, 1</p> Fast Running Median using an Indexable Skiplist (Fast version) (Python) 2010-03-03T11:06:29-08:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/577073-fast-running-median-using-an-indexable-skiplist-fa/ <p style="color: grey"> Python recipe 577073 by <a href="/recipes/users/178123/">Raymond Hettinger</a> (<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/indexable/">indexable</a>, <a href="/recipes/tags/median/">median</a>, <a href="/recipes/tags/running/">running</a>, <a href="/recipes/tags/skiplist/">skiplist</a>, <a href="/recipes/tags/statistics/">statistics</a>). Revision 5. </p> <p>Fast version of r576930 reimplemented using a list of lists instead of a node class. </p>