Last active
October 9, 2020 11:16
-
-
Save sharkdeng/0a530716497b33fdbb26987a70a5b0f9 to your computer and use it in GitHub Desktop.
judge if the given value is nan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_nan(a): | |
import math | |
import numpy as np | |
if isinstance(a, float): | |
return math.isnan(a) | |
elif isinstance(a, np.float64): | |
return np.isnan(a) | |
else: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment