summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2019-05-21 09:43:43 +0300
committerGitHub <noreply@github.com>2019-05-21 09:43:43 +0300
commit9608ac937e447380e730b49b146599c923b6a23b (patch)
tree04e0de1bf213c8d55ee2f9a7ad47b0b0f0f07884
parentf9c1502e7ace9b48f0256a77c560aae43763a1f2 (diff)
parent730bae9892c62342c7d59b4d44772fd9e231b766 (diff)
downloadnumpy-9608ac937e447380e730b49b146599c923b6a23b.tar.gz
Merge pull request #12025 from ThibHlln/patch-1
DOC: add detail for 'where' argument in ufunc
-rw-r--r--numpy/core/_add_newdocs.py10
-rw-r--r--numpy/core/code_generators/ufunc_docstrings.py8
2 files changed, 12 insertions, 6 deletions
diff --git a/numpy/core/_add_newdocs.py b/numpy/core/_add_newdocs.py
index e5e7f6667..7a7a433c0 100644
--- a/numpy/core/_add_newdocs.py
+++ b/numpy/core/_add_newdocs.py
@@ -4618,10 +4618,12 @@ add_newdoc('numpy.core', 'ufunc',
number of outputs; use `None` for uninitialized outputs to be
allocated by the ufunc.
where : array_like, optional
- Values of True indicate to calculate the ufunc at that position, values
- of False indicate to leave the value in the output alone. Note that if
- an uninitialized return array is created via the default ``out=None``,
- then the elements where the values are False will remain uninitialized.
+ This condition is broadcast over the input. At locations where the
+ condition is True, the `out` array will be set to the ufunc result.
+ Elsewhere, the `out` array will retain its original value.
+ Note that if an uninitialized `out` array is created via the default
+ ``out=None``, locations within it where the condition is False will
+ remain uninitialized.
**kwargs
For other keyword-only arguments, see the :ref:`ufunc docs <ufuncs.kwargs>`.
diff --git a/numpy/core/code_generators/ufunc_docstrings.py b/numpy/core/code_generators/ufunc_docstrings.py
index 6a5def4f2..2a5646bd7 100644
--- a/numpy/core/code_generators/ufunc_docstrings.py
+++ b/numpy/core/code_generators/ufunc_docstrings.py
@@ -26,8 +26,12 @@ subst = {
a freshly-allocated array is returned. A tuple (possible only as a
keyword argument) must have length equal to the number of outputs.
where : array_like, optional
- Values of True indicate to calculate the ufunc at that position, values
- of False indicate to leave the value in the output alone.
+ This condition is broadcast over the input. At locations where the
+ condition is True, the `out` array will be set to the ufunc result.
+ Elsewhere, the `out` array will retain its original value.
+ Note that if an uninitialized `out` array is created via the default
+ ``out=None``, locations within it where the condition is False will
+ remain uninitialized.
**kwargs
For other keyword-only arguments, see the
:ref:`ufunc docs <ufuncs.kwargs>`.