If I try:
ints = np.arange(10)
ints[0] = np.nan
I get the following error:
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: cannot convert float NaN to integer
Is there a workaround here? The solution I have so far is to convert the array to dtype=float like so:
casted = np.array(ints,dtype=float)
casted[0] = np.nan # no errors