Thank you for sharing though. I expect more people to post this kinda thing in our ML, doesn't matter basic or advanced subject. This is so much better than topics like "Is X much better than Y?".
On Thu, Mar 24, 2011 at 1:00 PM, sweemeng ng <swees...@gmail.com> wrote: > I happens to have a instance where some data is in form of NaN(Not a > Number). When converted into decimal, and I have to filter those. > > In many language and the latest python is a method or function in form of. > is_nan or isnan, to check it. I happen to be unlucky enough to have python > 2.4 that don't have that. > > Fortunately there is a way to handle this. > http://en.wikipedia.org/wiki/NaN > > As some might already know, Basically the idea is, for x is NaN then x == x > is false. > > in python you can test it here > > f = float("NaN") > if f == f: > print "this should not print" > > or in decimal module > > from decimal import * > d = Decimal("NaN") > if d == d: > print "this should not print too" > > yes, it not as useful now as newer python version provide a is_nan method, > which is more intuitive. > > -- > To unsubscribe from and detail about this group > http://portal.mosc.my/osdc-my-mailing-list-information > > MOSC2011 http://fb.me/mosc2011 and http://portal.mosc.my/ > -- To unsubscribe from and detail about this group http://portal.mosc.my/osdc-my-mailing-list-information MOSC2011 http://fb.me/mosc2011 and http://portal.mosc.my/