NumPy Tutorial NumPy Statistics NumPy References

NumPy - angle() function

The NumPy angle() function returns the angle of the complex argument, element-wise. The syntax for using this function is given below:


numpy.angle(z, deg=False)


z Required. Specify the input array.
deg Optional. Return angle in degrees if True, radians if False (default).

Return Value

Returns angle of the complex argument, element-wise.


In the example below, angle() function is used to calculate angle (in degree) of the complex argument.

import numpy as np

Arr = np.array([[1+1j,1+2j],

print("Arr is:")

#calculating angle of Arr
print("\nAngle of Arr is:")
print(np.angle(Arr, deg=True))

The output of the above code will be:

Arr is:
[[1.+1.j 1.+2.j]
 [1.+3.j 1.+4.j]]

Angle of Arr is:
[[45.         63.43494882]
 [71.56505118 75.96375653]]

❮ NumPy - Functions