deg2rad

deg2rad(x, out=None, **kwargs)

Convert angles from degrees to radians.

Parameters:
x : ndarray or scalar

Angles in degrees.

out : ndarray or None, optional

A location into which the result is stored. If not provided or None, a freshly-allocated array is returned.

Returns:
y : ndarray or scalar

The corresponding angle in radians. This is a scalar if x is a scalar.

Notes

“deg2rad(x)” is “x * pi / 180”.

This function differs from the original numpy.arange in the following aspects:
  • Only support float32 and float64.
  • out must be in the same size of input.

Examples

>>> np.deg2rad(180)
3.1415927