Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Replace all IEEE 754 NaN values in an array with custom representations
ResourceFunction["ReplaceNaN"][data] replaces all IEEE 754 NaN values of array data with Indeterminate. | |
ResourceFunction["ReplaceNaN"][data,rep] replaces all IEEE 754 NaN values of array data with custom representation rep. |
Introduce an array from NumPy including IEEE 754 NaN values and replace them with Indeterminate:
In[1]:= | ![]() |
Out[2]= | ![]() |
NaN values can also be replaced by custom representations:
In[3]:= | ![]() |
Out[3]= | ![]() |
Direct computation involving NaN values may result in unexpected results:
In[5]:= | ![]() |
Out[5]= | ![]() |
NaNs should be replaced by Indeterminate for further computation:
In[6]:= | ![]() |
Out[6]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License