summaryrefslogtreecommitdiff
path: root/numpy/core/fromnumeric.py
diff options
context:
space:
mode:
authorAbhinav Sagar <40603139+abhinavsagar@users.noreply.github.com>2019-05-29 10:43:35 +0530
committerMatti Picus <matti.picus@gmail.com>2019-05-29 08:13:35 +0300
commit1f427353554e6403f87c01f81b6e414427faa5f0 (patch)
tree355c7694872f05978d134120efdf96d1434650cb /numpy/core/fromnumeric.py
parent8d55c39d75cf42a70833e23035fc24f1fcfa99bf (diff)
downloadnumpy-1f427353554e6403f87c01f81b6e414427faa5f0.tar.gz
DOC: Add note to ``nonzero`` docstring. (#13551)
* Added NOTE in numpy\core\fromnumeric.py
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r--numpy/core/fromnumeric.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
index 202802e2c..af2a5298d 100644
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -1795,6 +1795,11 @@ def nonzero(a):
Equivalent ndarray method.
count_nonzero :
Counts the number of non-zero elements in the input array.
+
+ Notes
+ -----
+ To obtain the non-zero values, it is recommended to use ``x[x.astype(bool)]``
+ which will correctly handle 0-d arrays.
Examples
--------