In plain python, replacing nans by numbers in-place in a numpy array is trivial. However, the following fails in when doing the same in Numba
@jit(nopython=True)
def dostuff():
x = np.array([[1,np.nan,3]]);
np.nan_to_num(x,copy=False);
dostuff()
How can I replace nans by zeros in a numpy array, in-place, in a Numba-compilable function? For one-dimensional one can do x[np.isnan(x)]=0
but for higher dimensions this fails as well.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…