summaryrefslogtreecommitdiff
path: root/numpy/core/fromnumeric.py
diff options
context:
space:
mode:
authorjsh9 <jsh9@users.noreply.github.com>2017-03-30 06:49:08 -0700
committerEric Wieser <wieser.eric@gmail.com>2017-03-30 14:49:08 +0100
commit77c875f66d2da61da7cecf40ecc8409a02bfc124 (patch)
treec861393c2cbe1cc23630f3d117fc0250aac7f52d /numpy/core/fromnumeric.py
parentab9b15ef0a80ea002d12498554853544bb25ad57 (diff)
downloadnumpy-77c875f66d2da61da7cecf40ecc8409a02bfc124.tar.gz
DOC: Updated doc of nonzero() to eliminate ambiguity (#8850)
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r--numpy/core/fromnumeric.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
index 58f8696d2..973ba7b3a 100644
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -1509,13 +1509,12 @@ def nonzero(a):
Examples
--------
- >>> x = np.eye(3)
+ >>> x = np.array([[1,0,0], [0,2,0], [1,1,0]])
>>> x
- array([[ 1., 0., 0.],
- [ 0., 1., 0.],
- [ 0., 0., 1.]])
- >>> np.nonzero(x)
- (array([0, 1, 2]), array([0, 1, 2]))
+ array([[1, 0, 0],
+ [0, 2, 0],
+ [1, 1, 0]])
+ >>> (array([0, 1, 2, 2], dtype=int64), array([0, 1, 0, 1], dtype=int64))
>>> x[np.nonzero(x)]
array([ 1., 1., 1.])