This is a pre-release version (2.5.0.dev0+git20251130.2de293a). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / imag

_ArrayFunctionDispatcher

numpy:imag

source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/lib/_type_check_impl.py :131

Signature

def   imag ( val )

Summary

Return the imaginary part of the complex argument.

Parameters

val : array_like

Input array.

Returns

out : ndarray or scalar

The imaginary component of the complex argument. If val is real, the type of val is used for the output. If val has complex elements, the returned type is float.

Examples

import numpy as np
a = np.array([1+2j, 3+4j, 5+6j])
a.imag
a.imag = np.array([8, 10, 12])
a
np.imag(1 + 1j)

See also

angle
real
real_if_close

Aliases

  • numpy.imag