#import the cmath module
import cmath

print(cmath.nanj)

The cmath.nanj  constant represents a complex numbers with an undefined imaginary part i.e Not a Number(NaN).   

Remember that in Python, a complex number is represented as a + bj where a is the real part and b is the imaginary part. If the imaginary part has a value of nanj, it indicates that the imaginary part is undefined.

cmath.nanj

The value returned is equivalent to complex('nanj')

import cmath

print(3 + cmath.nanj)
print(7 - cmath.nanj)
print(cmath.log(7 - cmath.nanj))