You can check if a value is np.nan using the numpy
package's isnan()
function. Here is an example code snippet:
main.py118 chars9 lines
Output:
main.py13 chars2 lines
Alternatively, you can also use the math.isnan()
function to check if a value is NaN
. But in order to use this function, you need to convert the value to a float first (if it is not already a float). Here is an example:
main.py119 chars9 lines
Output:
main.py13 chars2 lines
gistlibby LogSnag