Replace nan with zero and inf with finite numbers.
Returns an array or scalar replacing Not a Number (NaN) with zero, (positive) infinity with a very large number and negative infinity with a very small (or negative) number.
Parameters :  x : array_like


Returns :  out : ndarray, float

See also
Notes
Numpy uses the IEEE Standard for Binary FloatingPoint for Arithmetic (IEEE 754). This means that Not a Number is not equivalent to infinity.
Examples
>>> np.set_printoptions(precision=8)
>>> 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])