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

Anne Archibald peridot.faceted at gmail.com
Thu Jun 12 09:31:54 EDT 2008


2008/6/12 David Cournapeau <david at ar.media.kyoto-u.ac.jp>:
> Lorenzo Isella wrote:
>> but I do not know the command to identify a number vs an Inf or a nan
>> (my fictitious is_a_number condition).
>>
>
> What about numpy.isnan and numpy.isfinite ?

In fact np.isfinite(NaN) is False, so it's easy:

A = A[np.isfinite(A)]

Anne



More information about the SciPy-User mailing list