[SciPy-dev] scipy.stats.zs

Stefan van der Walt stefan at sun.ac.za
Fri Jun 30 03:33:15 CDT 2006

Hi Tim

On Fri, Jun 30, 2006 at 12:53:42PM +1000, Tim Leslie wrote:
> The function scipy.stats.zs, which calculates the z-score of each
> element of an array, currently recalculates the mean and samplestd for
> each element, which leads to an O(n^2) running time.  Writing the
> function as follows fixes this and brings it back to O(n) running
> time.

Fixed in SVN.

Used to be:

In [50]: timeit stats.zs(N.random.random(1000))
10 loops, best of 3: 123 ms per loop


In [4]: timeit stats.zs(N.random.random(1000))
1000 loops, best of 3: 348 µs per loop


More information about the Scipy-dev mailing list