numpy.radians#

numpy.radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'radians'>#

将角度从度转换为弧度。

参数:
xarray_like

以度为单位的输入数组。

outndarray, None, or tuple of ndarray and None, 可选

结果存储的位置。如果提供,其形状必须与输入广播后的形状兼容。如果未提供或为 None,则返回一个新分配的数组。元组(只能作为关键字参数提供)的长度必须等于输出的数量。

wherearray_like, 可选

此条件会在输入上广播。在条件为 True 的位置,out 数组将被设置为 ufunc 结果。在其他位置,out 数组将保留其原始值。请注意,如果通过默认的 out=None 创建了未初始化的 out 数组,则其中条件为 False 的位置将保持未初始化状态。

**kwargs

有关其他仅限关键字的参数,请参阅 ufunc 文档

返回:
yndarray

对应的弧度值。如果 x 是一个标量,则此值为一个标量。

另请参阅

deg2rad

等效函数

示例

>>> import numpy as np

将度数组转换为弧度

>>> deg = np.arange(12.) * 30.
>>> np.radians(deg)
array([ 0.        ,  0.52359878,  1.04719755,  1.57079633,  2.0943951 ,
        2.61799388,  3.14159265,  3.66519143,  4.1887902 ,  4.71238898,
        5.23598776,  5.75958653])
>>> out = np.zeros((deg.shape))
>>> ret = np.radians(deg, out)
>>> ret is out
True