numpy.positive
-
numpy.positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'positive'> -
Numerical positive, element-wise.
New in version 1.13.0.
- Parameters
-
-
xarray_like or scalar -
Input array.
-
- Returns
-
-
yndarray or scalar -
Returned array or scalar:
y = +x. This is a scalar ifxis a scalar.
-
Notes
Equivalent to
x.copy(), but only defined for types that support arithmetic.Examples
>>> x1 = np.array(([1., -1.])) >>> np.positive(x1) array([ 1., -1.])
The unary
+operator can be used as a shorthand fornp.positiveon ndarrays.>>> x1 = np.array(([1., -1.])) >>> +x1 array([ 1., -1.])
© 2005–2021 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/1.20/reference/generated/numpy.positive.html