In Python 3.6 checking on a string value x math.isnan(x) and np.isnan(x) raises an error.
So I can't check if the given value is NaN or not if I don't know beforehand it's a number.
The following seems to solve this issue
if str(x)=='nan' and type(x)!='str':
print ('NaN')
else:
print ('non NaN')