ExampleEdit & Run
#import the cmath module
import cmath

print(cmath.nanj)
Output:
nanj[Finished in 0.0154499770142138s]

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.

Syntax:
cmath.nanj

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

ExampleEdit & Run
import cmath

print(3 + cmath.nanj)
print(7 - cmath.nanj)
print(cmath.log(7 - cmath.nanj))
Output:
(3+nanj)(7+nanj)(nan+nanj)[Finished in 0.01465839589945972s]