From 77c875f66d2da61da7cecf40ecc8409a02bfc124 Mon Sep 17 00:00:00 2001 From: jsh9 Date: Thu, 30 Mar 2017 06:49:08 -0700 Subject: DOC: Updated doc of nonzero() to eliminate ambiguity (#8850) --- numpy/core/fromnumeric.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'numpy/core/fromnumeric.py') 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.]) -- cgit v1.2.1