Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74673
| From | Johann Hibschman <jhibschman@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: NaN comparisons - Call For Anecdotes |
| Date | 2014-07-17 14:49 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <osxwqbbzuqc.fsf@gmail.com> (permalink) |
| References | (2 earlier) <53BDAF90.8010709@jmunch.dk> <CAPM-O+yiioLm-UiV2fYqc2n9qZrN+_v6RkeqJ7mOQ3Kq+cH0CQ@mail.gmail.com> <mailman.11716.1404946997.18130.python-list@python.org> <osx38e010kj.fsf@gmail.com> <mailman.11929.1405611387.18130.python-list@python.org> |
Chris Angelico <rosuav@gmail.com> writes:
> But you also don't know that he hasn't. NaN doesn't mean "unknown", it
> means "Not a Number". You need a more sophisticated system that allows
> for uncertainty in your data.
Regardless of whether this is the right design, it's still an example of
use.
As to the design, using NaN to implement NA is a hack with a long
history, see
http://www.numpy.org/NA-overview.html
for some color. Using NaN gets us a hardware-accelerated implementation
with just about the right semantics. In a real example, these lists are
numpy arrays with tens of millions of elements, so this isn't a trivial
benefit. (Technically, that's what's in the database; a given analysis
may look at a sample of 100k or so.)
> You have a special business case here (the need to
> record information with a "maybe" state), and you need to cope with
> it, which means dedicated logic and planning and design and code.
Yes, in principle. In practice, everyone is used to the semantics of
R-style missing data, which are reasonably well-matched by nan. In
principle, (NA == 1.0) should be a NA (missing) truth value, as should
(NA == NA), but in practice having it be False is more useful. As an
example, indexing R vectors by a boolean vector containing NA yields NA
results, which is a feature that I never want.
Cheers,
Johann
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: NaN comparisons - Call For Anecdotes "Anders J. Munch" <2014@jmunch.dk> - 2014-07-10 01:03 +0200
Re: NaN comparisons - Call For Anecdotes Johann Hibschman <jhibschman@gmail.com> - 2014-07-17 11:12 -0400
Re: NaN comparisons - Call For Anecdotes Chris Angelico <rosuav@gmail.com> - 2014-07-18 01:36 +1000
Re: NaN comparisons - Call For Anecdotes Johann Hibschman <jhibschman@gmail.com> - 2014-07-17 14:49 -0400
Re: NaN comparisons - Call For Anecdotes Chris Angelico <rosuav@gmail.com> - 2014-07-18 04:55 +1000
Re: NaN comparisons - Call For Anecdotes Marko Rauhamaa <marko@pacujo.net> - 2014-07-17 22:10 +0300
Re: NaN comparisons - Call For Anecdotes Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-17 14:39 -0600
Re: NaN comparisons - Call For Anecdotes Marko Rauhamaa <marko@pacujo.net> - 2014-07-18 00:08 +0300
Re: NaN comparisons - Call For Anecdotes Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-17 17:00 -0600
Re: NaN comparisons - Call For Anecdotes Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-17 17:07 -0600
Re: NaN comparisons - Call For Anecdotes Chris Angelico <rosuav@gmail.com> - 2014-07-18 04:59 +1000
Re: NaN comparisons - Call For Anecdotes Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-18 17:57 +0000
Re: NaN comparisons - Call For Anecdotes Chris Angelico <rosuav@gmail.com> - 2014-07-19 05:49 +1000
csiph-web