Numpy deg2rad() method

This function is used to convert the angles from degree to radian.

Syntax

snippet
numpy.deg2rad(array, out)

Parameters

  1. array: these are the angles whose degree values are to be calculated.
  2. Out: It is the shape of the output array.

Return

It returns an array containing equivalent degree angles to the radian given in the input array.

Example

snippet
import numpy as np 
import math

arr = [0, math.pi/2, math.pi/4, math.pi/6 ] 
print ("Input array : \n", arr) 

radval = np.deg2rad(arr) 
print ("\n Radian value : \n", radval)

Output:

Output
Input array : [0, 1.5707963267948966, 0.7853981633974483, 0.5235987755982988] Radian value : [0. 0.02741557 0.01370778 0.00913852]
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents