basic statistics in python

dsavitsk dsavitsk at e-coli.net
Thu Mar 14 17:39:27 EST 2002


this is really embarassing :-)

>>> import win32com.client
>>> xl = win32com.client.Dispatch('Excel.Application')
>>> xl.WorksheetFunction.StDev(1,1,1,3,3,45,3,2,1,1,2,3,2,1)
11.565627361442019
>>> xl.WorksheetFunction.Pearson((1,4,3,2,5),(5,3,2,5,4))
-0.48507125007266594

-d


"dsavitsk" <dsavitsk at e-coli.net> wrote in message
news:OvQj8.10177$k5.3810357 at newssvr28.news.prodigy.com...
> 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