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

Anne Archibald peridot.faceted@gmail....
Thu Jun 12 08:31:54 CDT 2008


2008/6/12 David Cournapeau <david@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