This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / real

_ArrayFunctionDispatcher

numpy:real

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

Signature

def   real ( val )

Summary

Return the real part of the complex argument.

Parameters

val : array_like

Input array.

Returns

out : ndarray or scalar

The real 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.real
a.real = 9
a
a.real = np.array([9, 8, 7])
a
np.real(1 + 1j)

See also

angle
imag
real_if_close

Aliases

  • numpy.real