Friday, December 27, 2024
Google search engine
HomeLanguagesnumpy.real() function – Python

numpy.real() function – Python

numpy.real() function return the real part of the complex argument.

Syntax : numpy.real(arr)

Parameters :
arr : [array_like] Input array.

Return : [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.

Code #1 :




# Python program explaining
# numpy.real() function
       
# importing numpy as geek 
import numpy as geek 
   
arr = geek.array([1 + 3j, 5 + 7j, 9 + 11j])
   
gfg = arr.real
   
print (gfg)


Output :

[1. 5. 9.]

 
Code #2 :




# Python program explaining
# numpy.real() function
       
# importing numpy as geek 
import numpy as geek 
   
arr = geek.array([2 + 3j, 5 + 6j, 8 + 9j])
   
gfg = arr.real
   
print (gfg)


Output :

[2. 5. 8.]
Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments