diff options
author | Brandon Carter <bcarter@mit.edu> | 2017-08-21 16:24:24 -0700 |
---|---|---|
committer | Brandon Carter <bcarter@mit.edu> | 2017-08-21 16:24:24 -0700 |
commit | 6aed49135b26fe23620b15cab6c3b99c56545867 (patch) | |
tree | 3cec4810a1eaeea2f7f12aa011dc608f4dfde5ff /numpy/core/fromnumeric.py | |
parent | a0c5f64f4f1a7f6ee80dc9b95aa813df28a87d72 (diff) | |
download | numpy-6aed49135b26fe23620b15cab6c3b99c56545867.tar.gz |
update example in np.nonzero docstring
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r-- | numpy/core/fromnumeric.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 338248ce3..10b20c0b1 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -1529,14 +1529,15 @@ def nonzero(a): [0, 2, 0], [1, 1, 0]]) >>> np.nonzero(x) - (array([0, 1, 2, 2], dtype=int64), array([0, 1, 0, 1], dtype=int64)) + (array([0, 1, 2, 2]), array([0, 1, 0, 1])) >>> x[np.nonzero(x)] - array([ 1., 1., 1.]) + array([1, 2, 1, 1]) >>> np.transpose(np.nonzero(x)) array([[0, 0], [1, 1], - [2, 2]]) + [2, 0], + [2, 1]) A common use for ``nonzero`` is to find the indices of an array, where a condition is True. Given an array `a`, the condition `a` > 3 is a |