Yes, It is possible to use the NaN variable without NumPy in Python.

You can use float('nan') for the following. In Python 3.5, you can also use math.nan.

>>> a = float('nan')

>>> print(a)

nan

>>> print(a + 2)

nan

>>> a == a

False

>>> import math

>>> math.isnan(a)

True

>>> # Python 3.5+

>>> math.isnan(math.nan)

True