AttributeError: 'numpy.ndarray' object has no attribute 'nan_to_num'
You are using the right method but in a wrong way :)
nan_to_num is a method of numpy module, not numpy.ndarray. So instead of calling nan_to_num on you data, call it on numpy module giving your data as a paramter:
import numpy as np
data = np.array([1,2,3,np.nan,np.nan,5])
data_without_nan = np.nan_to_num(data)

prints:
array([1., 2., 3., 0., 0., 5.])

In your example:
import numpy as np
val = np.nan_to_num(setTo.ravel())