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
objectarrays returns elementwise.imagor0if.imagis undefined.Examples
>>> import numpy as np >>> x = np.sqrt([1+0j, 0+1j]) >>> x.imag array([ 0. , 0.70710678]) >>> x.imag.dtype dtype('float64')