__complex__

array.__complex__() complex

Converts a zero-dimensional array to a Python complex object.

Parameters:

self (array) – zero-dimensional array instance.

Returns:

out (complex) – a Python complex object representing the single element of the array instance.

Notes

Special cases

For boolean operands,

  • If self is True, the result is 1+0j.

  • If self is False, the result is 0+0j.

For real-valued floating-point operands,

  • If self is NaN, the result is NaN + NaN j.

  • If self is +infinity, the result is +infinity + 0j.

  • If self is -infinity, the result is -infinity + 0j.

  • If self is a finite number, the result is self + 0j.

New in version 2022.12.