My if condition in Python is not working. It is going inside the condition but it should not. Below is the code snippet:
a = np.nan
if a is not None :
a = "".join(a)
The code is going inside the if condition and I don't know why.
My if condition in Python is not working. It is going inside the condition but it should not. Below is the code snippet:
a = np.nan
if a is not None :
a = "".join(a)
The code is going inside the if condition and I don't know why.
np.nan
is not a type of None. You can check it by using type(np.nan)
, which returns <class 'float'>
.
np.nan is a class, it is not a None