basic statistics in python

dsavitsk dsavitsk at e-coli.net
Wed Mar 13 17:36:30 EST 2002


hi all,

never having done numeric calculations in python* i am seeking advice on how
to best go about doing some basic statistics.  in particular, i need to find
standard deviations and point bi-serial correlations**, and i am seeking
advice on the best way to go about it.  i know how to do them, but i am
wondering if there are prebuilt modules that might simplify the task.

i found this
http://starship.python.net/crew/hinsen/ScientificPythonManual/
but it seems to be unix only and i am on win32. as far as standard
deviations, i found this in an old ng post.

def stddev( *x ):
    if not x : return 0
    if ( len(x) == 1 ): x = x[0]
    m = mean( x )
    var = 0
    for n in x:
        n = n - m
        var = var + (n * n)
    return sqrt( var  / float(len(x)-1) )

There seems to be some stuff in scipy, but i am having trouble geting
through the docs.  also, do i want to look at numpy?

any suggestions?

thanks,

doug



*   all text processing thus far.
**  i think that is the correct term, item total correlations in other
words.
*** in general though nobody is going to live or die by what the state say,
so a small amount of error is not too big a deal.





More information about the Python-list mailing list