Python | Numpy ndarray.imag ()

With the ` Numpy ndarray.imag () ` method, we can find imaginary values ​​in imaginary expressions simply by using ` ndarray.imag () `. Remember that the resulting data type for the apparent value —  “float64” .

Syntax: `ndarray.imag()`

Return: Array of imaginary values ​​having dtype `float64`

Example # 1:
In this example we can see that we are getting an array of imaginary values ​​using ` ndarray.imag () ` and we are also trying to print the dtype of these imag values.

 ` # import an important module into python ` ` import ` ` numpy as np `   ` # make an array with NumPy ` ` gfg ` ` = ` ` np.array ([` ` 1 ` ` + ` ` 2j ` `, ` 2 ` + ` ` 3j ` `]) `   ` # applying the ndarray.imag () method ` ` geeks ` ` = ` ` np.imag (gfg) `   ` print ` ` (geeks, end ` ` = ` ` `` ` `) ` ` print ` ` (np.imag (geeks) .dtype) `

Exit:

` [2. 3.] float64 `

Example # 2:

 ` # import important module in python ` ` import numpy as np `   ` # make an array with NumPy ` ` gfg ` ` = ` ` np.array ( [` ` 1 ` ` + ` ` 2j ` `, ` ` 2 ` ` + ` ` 3j ` `]) ` ` gfg ` ` = ` ` np.sqrt (gfg) `   ` # applying the ndarray.imag ( ) ` ` geeks ` ` = ` ` np.imag ( gfg) `   ` print ` ` (geeks, end ` ` = ` `` `` `) ` ` print ` ` (np.imag (geeks) .dtype) `

Output:

` [0.78615138 0.89597748] float64 `