[Numpy-discussion] NA masks for NumPy are ready to test

Mark Wiebe mwwiebe at gmail.com
Sat Aug 20 12:32:40 EDT 2011


On Fri, Aug 19, 2011 at 4:52 PM, Bruce Southey <bsouthey at gmail.com> wrote:

> On Fri, Aug 19, 2011 at 3:05 PM, Mark Wiebe <mwwiebe at gmail.com> wrote:
> > On Fri, Aug 19, 2011 at 11:44 AM, Charles R Harris
> > <charlesr.harris at gmail.com> wrote:
> >>
> >><snip>
> >>
> >>
> >> My main peeve is that NA is upper case ;) I suppose that could use some
> >> discussion.
> >
> > There is some proliferation of cases in the NaN case:
> >>>> np.nan
> > nan
> >>>> np.NAN
> > nan
> >>>> np.NaN
> > nan
> > The pros I see for NA over na are:
> > * less confusion of NA vs nan (should this carry over to the np.isna
> > function, should it be np.isNA according to this point?)
> > * more comfortable for switching between NumPy and R when people have to
> use
> > both at the same time
> > The main con is:
> > * Inconsistent with current nan, inf printing. Here's a hackish
> workaround:
> >>>> np.na = np.NA
> >>>> np.set_printoptions(nastr='na')
> >>>> np.array([np.na, 2.0])
> > array([na,  2.])
> > What's your list of pros and cons?
> > -Mark
> >
> >>
> >> Chuck
> >>
>
> In part I sort of like to have NA and nan since poor
> eyesight/typing/editing avoiding problems dropping the last 'n'.
>
> Regarding nan/NAN, do you mean something like my ticket 1051?
> http://projects.scipy.org/numpy/ticket/1051
> I do not care that much about the case (mixed case is not good)
> provided that there is only one to specify these.
>
> Also should np.isfinite() return False for np.NA?
> >>> np.isfinite([1,2,np.NA,4])
> array([ True,  True, NA,  True], dtype=bool)
>

This is correct according to the NA computational model in the NEP. An NA
represents a value which exists but is unknown, and could be anything
representable by the type. Thus, it could the a finite number or it could be
inf, meaning the answer to isfinite could be True or it could be False, and
the answer must be NA.


> Anyhow, many thanks for the replies to my observations and your
> amazing effect in getting this done.
>

Thanks for taking the time to take the software for a spin, I appreciate
your feedback!

-Mark


>
> Bruce
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110820/abda3013/attachment.html>


More information about the NumPy-Discussion mailing list