Replace nan with zero and inf with large numbers.
Parameters: | x : array_like
|
---|---|
Returns: | out : ndarray
|
Examples
>>> x = np.array([np.inf, -np.inf, np.nan, -128, 128])
>>> np.nan_to_num(x)
array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000,
-1.28000000e+002, 1.28000000e+002])