[Numpy-discussion] alterNEP - was: missing data discussion round 2

Keith Goodman kwgoodman at gmail.com
Thu Jun 30 21:36:18 EDT 2011


On Thu, Jun 30, 2011 at 10:51 AM, Nathaniel Smith <njs at pobox.com> wrote:
> On Thu, Jun 30, 2011 at 6:31 AM, Matthew Brett <matthew.brett at gmail.com> wrote:
>> In the interest of making the discussion as concrete as possible, here
>> is my draft of an alternative proposal for NAs and masking, based on
>> Nathaniel's comments.  Writing it, it seemed to me that Nathaniel is
>> right, that the ideas become much clearer when the NA idea and the
>> MASK idea are separate.   Please do pitch in for things I may have
>> missed or misunderstood:
> [...]
>
> Thanks for writing this up! I stuck it up as a gist so we can edit it
> more easily:
>  https://gist.github.com/1056379/
> This is your initial version:
>  https://gist.github.com/1056379/c809715f4e9765db72908c605468304ea1eb2191
> And I made a few changes:
>  https://gist.github.com/1056379/33ba20300e1b72156c8fb655bd1ceef03f8a6583
> Specifically, I added a rationale section, changed np.MASKED to
> np.IGNORE (as per comments in this thread), and added a vowel to
> "propmsk".

It might be helpful to make a small toy class in python so that people
can play around with NA and IGNORE from the alterNEP.

I only had a few minutes, so I only took it this far (1d arrays only):

    >> from nary import nary, NA, IGNORE
    >> arr = np.array([1,2,3,4,5,6])
    >> nar = nary(arr)
    >> nar
    1.0000, 2.0000, 3.0000, 4.0000, 5.0000, 6.0000,
    >> nar[2] = NA
    >> nar
    1.0000, 2.0000, NA, 4.0000, 5.0000, 6.0000,
    >> nar[4] = IGNORE
    >> nar
    1.0000, 2.0000, NA, 4.0000, IGNORE, 6.0000,
    >> nar[4]
    IGNORE
    >> nar[3]
    4
    >> nar[2]
    NA

The gist is here: https://gist.github.com/1057686

It probably just needs an __add__ and a reducing function such as sum,
but I'm out of time, or so my family tells me.

Implementation? Yes, with masks.



More information about the NumPy-Discussion mailing list