[Scipy-tickets] [SciPy] #1862: Allow canonical keyword arguments for distribution parameters

SciPy Trac scipy-tickets@scipy....
Fri Mar 8 15:06:49 CST 2013


#1862: Allow canonical keyword arguments for distribution parameters
-----------------------------+----------------------------------------------
 Reporter:  chrisfonnesbeck  |       Owner:  somebody   
     Type:  enhancement      |      Status:  new        
 Priority:  normal           |   Milestone:  Unscheduled
Component:  Other            |     Version:  0.11.0     
 Keywords:                   |  
-----------------------------+----------------------------------------------
 It seems strange that I cannot parameterize a distribution in scipy.stats
 with keyword arguments that every statistician would be familiar with. For
 example, the following works:


 {{{
 In [7]: binom.rvs(10, 0.3, size=5)
 Out[7]: array([2, 1, 6, 5, 3])
 }}}

 yet this does not:

 {{{
 In [8]: binom.rvs(n=10, p= 0.3, size=5)
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)
 <ipython-input-8-3db5f6a94f32> in <module>()
 ----> 1 binom.rvs(n=10,p= 0.3, size=5)

 /Library/Python/2.7/site-
 packages/scipy-0.13.0.dev_c31f167_20130307-py2.7-macosx-10.8-intel.egg/scipy/stats/distributions.pyc
 in rvs(self, *args, **kwargs)
    5921         """
    5922         kwargs['discrete'] = True
 -> 5923         return super(rv_discrete, self).rvs(*args, **kwargs)
    5924
    5925     def pmf(self, k,*args, **kwds):

 /Library/Python/2.7/site-
 packages/scipy-0.13.0.dev_c31f167_20130307-py2.7-macosx-10.8-intel.egg/scipy/stats/distributions.pyc
 in rvs(self, *args, **kwds)
     609         args, loc, scale, size = self._fix_loc_scale_kwarg3(args,
 loc, scale,
     610                                                             size)
 --> 611         cond = logical_and(self._argcheck(*args),(scale >= 0))
     612         if not all(cond):
     613             raise ValueError("Domain error in arguments.")

 TypeError: _argcheck() takes exactly 3 arguments (1 given)

 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1862>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list