[SciPy-dev] PEP: Improving the basic statistical functions in Scipy
Fri Feb 27 17:01:29 CST 2009
Pierre GM wrote:
> On Feb 27, 2009, at 4:52 PM, email@example.com wrote:
>> For most of the current statistical functions, with the exception of
>> different tie handling, I think that we can expand the _chk_asarray to
>> do the necessary preprocessing.
> Mmh. _chk_asarray will always return a MA. Is it what you want? Are you
> An idea is then to use the 'usemask' parameter I was talking about
> * if usemask is False (default), return a ndarray
> * If usemask is True, return a MA
> * if the input is a MA (w/ or w/o missing values), set usemask to
> True, and mask the NaNs/Infs first w/ ma.fix_invalid.
This may not be appropriate for scipy, but for my own purposes I
included a third option for the similar "masked" kwarg in a simple stats
masked='auto' makes the output masked if and only if the input is masked.
> That way, we need only one function. If we really need it, we can have
> duplicate functions in scipy.mstats where usemask is set to True by
> Now, for the actual implementation:
> * usemask=False and some NaNs: return NaN
> * usemask=True: use the ma implementation.
>>>>> 1) #inconsistent return type
>> array([ 0., 0.])
> That's a bug, we should have a MA.
> Scipy-dev mailing list
More information about the Scipy-dev