summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPieter <pmvz_github@outlook.com>2023-02-10 18:16:03 +0100
committerGitHub <noreply@github.com>2023-02-10 18:16:03 +0100
commitbaa84cfa9c0b68d9d540be749da77a7c9928980e (patch)
tree695a31ffa1d8fd30045fb650089547aab803f060 /doc
parentc6c9f311479666e179ca7877eb47af5a33bf7f38 (diff)
downloadnumpy-baa84cfa9c0b68d9d540be749da77a7c9928980e.tar.gz
Apply suggestions from code review
Co-authored-by: Mukulika <60316606+Mukulikaa@users.noreply.github.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/source/user/how-to-index.rst6
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/source/user/how-to-index.rst b/doc/source/user/how-to-index.rst
index 318ac515d..02db91670 100644
--- a/doc/source/user/how-to-index.rst
+++ b/doc/source/user/how-to-index.rst
@@ -310,9 +310,9 @@ result as dimensions with size one::
<BLANKLINE>
[[2, 2, 2, 2, 2]]])
-To get the indices of each maximum or minimum value for each (N-1)-dimensional array in an N-dimensional array, use :meth:`reshape` to reshape the array to a 2D array, apply argmax or argmin along ``axis=1`` and use :meth:`unravel_index` to recover the index of the values per slice::
+To get the indices of each maximum or minimum value for each (N-1)-dimensional array in an N-dimensional array, use :meth:`reshape` to reshape the array to a 2D array, apply :meth:`argmax` or :meth:`argmin` along ``axis=1`` and use :meth:`unravel_index` to recover the index of the values per slice::
- >>> x = np.arange(2*2*3).reshape(2,2,3) % 7 # 3D example array
+ >>> x = np.arange(2*2*3).reshape(2, 2, 3) % 7 # 3D example array
>>> x
array([[[0, 1, 2],
[3, 4, 5]],
@@ -326,7 +326,7 @@ To get the indices of each maximum or minimum value for each (N-1)-dimensional a
>>> np.unravel_index(indices_2d, x.shape[1:])
(array([1, 0]), array([2, 0]))
-The first array returned contains the indices along axis 1 in the original array, the second array contains the indices along axis 2. The highest value in ``x[0]`` is therefore ``x[0,1,2]``.
+The first array returned contains the indices along axis 1 in the original array, the second array contains the indices along axis 2. The highest value in ``x[0]`` is therefore ``x[0, 1, 2]``.
Index the same ndarray multiple times efficiently
=================================================