summaryrefslogtreecommitdiff
path: root/numpy/doc/indexing.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/doc/indexing.py')
-rw-r--r--numpy/doc/indexing.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/numpy/doc/indexing.py b/numpy/doc/indexing.py
index d3f442c21..9e9f0a10c 100644
--- a/numpy/doc/indexing.py
+++ b/numpy/doc/indexing.py
@@ -1,5 +1,4 @@
-"""
-==============
+"""==============
Array indexing
==============
@@ -50,7 +49,7 @@ than dimensions, one gets a subdimensional array. For example: ::
That is, each index specified selects the array corresponding to the
rest of the dimensions selected. In the above example, choosing 0
-means that remaining dimension of lenth 5 is being left unspecified,
+means that the remaining dimension of length 5 is being left unspecified,
and that what is returned is an array of that dimensionality and size.
It must be noted that the returned array is not a copy of the original,
but points to the same values in memory as does the original array.
@@ -62,7 +61,7 @@ element being returned. That is: ::
2
So note that ``x[0,2] = x[0][2]`` though the second case is more
-inefficient a new temporary array is created after the first index
+inefficient as a new temporary array is created after the first index
that is subsequently indexed by 2.
Note to those used to IDL or Fortran memory order as it relates to
@@ -229,10 +228,13 @@ most straightforward case, the boolean array has the same shape: ::
>>> y[b]
array([21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34])
-The result is a 1-D array containing all the elements in the indexed
-array corresponding to all the true elements in the boolean array. As
-with index arrays, what is returned is a copy of the data, not a view
-as one gets with slices.
+Unlike in the case of integer index arrays, in the boolean case, the
+result is a 1-D array containing all the elements in the indexed array
+corresponding to all the true elements in the boolean array. The
+elements in the indexed array are always iterated and returned in
+:term:`row-major` (C-style) order. The result is also identical to
+``y[np.nonzero(b)]``. As with index arrays, what is returned is a copy
+of the data, not a view as one gets with slices.
The result will be multidimensional if y has more dimensions than b.
For example: ::