I am using the following code on a high computation cluster:
array = np.nan_to_num(
array,
copy = False,
# Replace
nan = 0.0,
posinf = 0.0,
neginf = 0.0
)
The code causes the following error:
Module for Anaconda3 2019.03 loaded.
Run script ...
Traceback (most recent call last):
File "test.py", line 118, in <module>
neginf = 0.0
TypeError: nan_to_num() got an unexpected keyword argument 'nan'
Done
I googled the error. Apparently, my code can only be run by NumPy > v1.17
. The high computation cluster environment uses NumPy v1.16.2
and Python v3.7.3
.
What code snippet can replace my code snippet above?