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

Johann Cohen-Tanugi cohen@slac.stanford....
Sun Jun 15 12:36:04 CDT 2008


In [1]: import numpy

In [2]: numpy.nan_to_num?
Type:           function
Base Class:     <type 'function'>
String Form:    <function nan_to_num at 0xb79a1844>
Namespace:      Interactive
File:           /usr/lib/python2.5/site-packages/numpy/lib/type_check.py
Definition:     numpy.nan_to_num(x)
Docstring:
    Returns a copy of replacing NaN's with 0 and Infs with large numbers
   
    The following mappings are applied:
        NaN -> 0
        Inf -> limits.double_max
       -Inf -> limits.double_min

JCT

Tim Gray wrote:
> nan_to_num() does this. I think it's somewhere in numpy.
>
> Makes Nan's -> 0's and infs -> machine limits.
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>   


More information about the SciPy-user mailing list