[SciPy-user] How to get rid of nan and Inf

Lorenzo Isella lorenzo.isella@gmail....
Thu Jun 12 04:11:05 CDT 2008

Dear All,
Say that you have an array which represents the time evolution of
certain quantities as time progresses.
Some entries of this array could be ill-defined (coming from a
division by zero or an indefinite error on a linear regression). How
can you automatically get rid of these?
I am looking for something like:

remove_ill_defined=where(array_ill_defined == is_a_number)

but I do not know the command to identify a number vs an Inf or a nan
(my fictitious is_a_number condition).


More information about the SciPy-user mailing list