[SciPy-dev] stats confusion

Neal Becker ndbecker2@gmail....
Wed Jun 17 07:23:10 CDT 2009

I'm still finding stats usage confusing.  The doc 


chi2.cdf(x,df,loc=0,scale=1) :

And even has an example:
prb = chi2.cdf(x,df)

But if df is given as keyword:
 scipy.stats.chi2.cdf(1, df=2)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1331, 0))

TypeError                                 Traceback (most recent call last)

/home/nbecker/globalstar/<ipython console> in <module>()

/usr/lib64/python2.6/site-packages/scipy/stats/distributions.pyc in 
cdf(self, x, *args, **kwds)
    623         if any(cond):  #call only if at least 1 entry
    624             goodargs = argsreduce(cond, *((x,)+args))
--> 625             place(output,cond,self._cdf(*goodargs))
    626         if output.ndim == 0:
    627             return output[()]

TypeError: _cdf() takes exactly 3 arguments (2 given)

What's going on here?  Do stats not accept keyword args as per normal python 

More information about the Scipy-dev mailing list