numpy.ndarray.imag#

attribute

ndarray.imag#

The imaginary part of the array.

Returns a view into the original array for complex arrays. For non-complex arrays, returns a zero array of the same dtype. For object arrays returns elementwise .imag or 0 if .imag is undefined.

Examples

>>> import numpy as np
>>> x = np.sqrt([1+0j, 0+1j])
>>> x.imag
array([ 0.        ,  0.70710678])
>>> x.imag.dtype
dtype('float64')