Numpy.degrees() method is “used to convert angles from radians to degrees.” The np.degrees() method accepts a value in radians and returns that value in the degree.
Syntax
numpy.degrees(arr[, out]) = ufunc ‘degrees’)
Parameters
The degrees() function takes up to two main parameters:
- arr: This is the array whose elements are converted in degrees.
- out: A position the result will be stored in. If given, the shape to which the inputs broadcast must be in. If the freshly-allocated array is returned unless received or None. The tuple (possible as a keyword argument only) must have a length equal to the outputs.
Return Value
The degrees() function returns an array the same size as the input array, containing a degree value inplace of a radian value, but the return value will be in float data type.
Example 1: How to Use numpy.degrees() Method
import numpy as np
import math
#Storing value of pi in x
x = math.pi
#declaring array
arr = [0, x / 4, x / 3, x / 2, x]
#Printing array
print(arr)
#Now we will convert radian values to degree
arr1 = np.degrees(arr)
#Printing degree values
print("New array is:")
print(arr1)
Output
[0, 0.7853981633974483, 1.0471975511965976, 1.5707963267948966, 3.141592653589793]
New array is:
[ 0. 45. 60. 90. 180.]
Example 2: Using np.degrees() with np.sum() method
import numpy as np
import math
#Storing value of pi in x
x = math.pi
#declaring array
arr = [x / 4, x / 2]
#Printing array
print(arr)
#Now we will convert radian values to degree
arr1 = np.degrees(arr)
#Printing degree values
print("New array is:")
print(arr1)
sum_two = np.sum(arr1)
#Printing value of the third angle
print("The third angle is: ", 180 - sum_two)
Output
[0.7853981633974483, 1.5707963267948966]
New array is:
[45. 90.]
The third angle is : 45.0
That is it for converting radians to degrees in Numpy.

Ankit Lathiya is a Master of Computer Application by education and Android and Laravel Developer by profession and one of the authors of this blog. He is also expert in JavaScript and Python development.