[SciPy-Dev] stats.nanstd interface

Pierre GM pgmdevlist@gmail....
Sun Jun 20 20:58:32 CDT 2010


On Jun 20, 2010, at 9:44 PM, Skipper Seabold wrote:
>> 
>> I really think that all these stats 'nan functions' probably could
>> just be converted into masked arrays and using the appropriate masked
>> array functions instead of creating separate functions. This would
>> also address how to handle the 'out' argument.
>> 
> 
> Someone can correct me if I'm wrong, but I believe that there is a
> performance hit for using masked arrays over the nan functions.  Wes
> and Keith have mentioned it wrt pandas and larry, if I recall.

Not a surprise at all: the nanfunctions make use of np.putmask which is quite efficient, while MaskedArrays have their extra baggage  (in __array_finalize__) which tend to slow things down. However, the nanfunctions work only w/ float arrays, while the MaskedArrays function are more generic.


More information about the SciPy-Dev mailing list