On Mon, Jun 22, 2009 at 4:15 PM, Elisha Rosensweig<bensha...@gmail.com> wrote:
> Hi,
>
> I have a list with some values being NaN (after division-by-zero). How can I
> check and remove all the NaN values?

In Python 2.6 you can use math.isnan() to check for NaN, so you can
filter your list by
newList = [ x for x in oldList if not math.isnan(x) ]

In older versions of Python I don't know how to do this.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to