[Numpy-discussion] New patch for MA

Pierre GM pgmdevlist at mailcan.com
Thu Apr 6 19:19:02 CDT 2006


Sasha,
Thanks for your advice with SVN. I'll make sure to use that method from now 
on.

> 1. I've initially implemented some ma array methods by wrapping existing
> module level functions.  I am not sure this is the best approach to
> implement new methods. It is probably cleaner to implement them as methods
> and provide wrappers at the module level similar to oldnumeric.

Well, I tried to stick to the latest convention, getting rid of the _wrapit 
part. Let me know.
>
> 2. I am not sure cumprod and cumsum should fill masked elements with 1 and
> 0. 
Good point for the object/string arrays, yet other cases I overlooked (I'm 
still not used to object arrays, I'm now realizing they're quite useful).

Actually, I coded that way because it's how I use these functions. But well, 
as many settings as users, eh?

Michael's suggestion of introducing R-like options sounds interesting, but I 
wonder whether it would not be a bit heavy for methods, with the introduction 
of an extra flag. That'd be great for functions, though. 
So, for cumsum and cumprod methods, maybe we could stick to Sasha's and 
Michael's preference (mask all values after the first missing), and we would 
just have to create two functions. We could use the 4 R ones: na.omit, 
na.fail, na.pass, na.exclude.

For our current problem (cumsum,cumprod)
na.omit: would return the result I implemented (fill with 0 or 1)
na.fail: would return masked values after the first missing
na.exclude: would correspond to compressed().cumsum() ? I don't like that, it 
changes the initial length/size
na.pass: I don't know...





More information about the Numpy-discussion mailing list