numpy.positive

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

数值正,元素方向。

1.13.0 新版功能.

参数
x类数组或标量数组

输入数组。

返回
yndarray或scalar

返回的数组或标量: y = +x . 这是一个标量,如果 x 是标量。

笔记

相当于 x.copy() ,但仅为支持算术的类型定义。

实例

>>> x1 = np.array(([1., -1.]))
>>> np.positive(x1)
array([ 1., -1.])

一元的 + 运算符可用作 np.positive 在星期天。

>>> x1 = np.array(([1., -1.]))
>>> +x1
array([ 1., -1.])