numpy.positive#
- numpy.positive(x,/,out=None,*,where=True,casting='same_kind',order='K',dtype=None,subok=True[,signature])=<ufunc'positive'>#
Numerical positive, element-wise.
- Parameters:
- xarray_like or scalar
Input array.
- Returns:
- yndarray or scalar
Returned array or scalar:y = +x.This is a scalar ifx is a scalar.
Notes
Equivalent tox.copy(), but only defined for types that supportarithmetic.
Examples
>>>importnumpyasnp
>>>x1=np.array(([1.,-1.]))>>>np.positive(x1)array([ 1., -1.])
The unary
+operator can be used as a shorthand fornp.positiveonndarrays.>>>x1=np.array(([1.,-1.]))>>>+x1array([ 1., -1.])
On this page