Skip to content

Commit b95cfa5

Browse files
authored
Merge pull request #20093 from Mukulikaa/indexing-howto
DOC: Created an indexing how-to
2 parents d90298e + 916b65a commit b95cfa5

File tree

5 files changed

+361
-3
lines changed

5 files changed

+361
-3
lines changed

doc/source/user/basics.copies.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ do not reflect on the original array. Making a copy is slower and
3939
memory-consuming but sometimes necessary. A copy can be forced by using
4040
:meth:`.ndarray.copy`.
4141

42+
.. _indexing-operations:
43+
4244
Indexing operations
4345
===================
4446

doc/source/user/basics.indexing.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Note that in Python, ``x[(exp1, exp2, ..., expN)]`` is equivalent to
2828
``x[exp1, exp2, ..., expN]``; the latter is just syntactic sugar
2929
for the former.
3030

31+
.. _basic-indexing:
3132

3233
Basic indexing
3334
--------------
@@ -88,6 +89,7 @@ that is subsequently indexed by 2.
8889
rapidly changing location in memory. This difference represents a
8990
great potential for confusion.
9091

92+
.. _slicing-and-striding:
9193

9294
Slicing and striding
9395
^^^^^^^^^^^^^^^^^^^^
@@ -226,6 +228,7 @@ concepts to remember include:
226228
.. index::
227229
pair: ndarray; view
228230

231+
.. _dimensional-indexing-tools:
229232

230233
Dimensional indexing tools
231234
^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -470,6 +473,7 @@ such an array with an image with shape (ny, nx) with dtype=np.uint8
470473
lookup table) will result in an array of shape (ny, nx, 3) where a
471474
triple of RGB values is associated with each pixel location.
472475

476+
.. _boolean-indexing:
473477

474478
Boolean array indexing
475479
^^^^^^^^^^^^^^^^^^^^^^
@@ -851,7 +855,7 @@ For this reason, it is possible to use the output from the
851855
:meth:`np.nonzero() <ndarray.nonzero>` function directly as an index since
852856
it always returns a tuple of index arrays.
853857

854-
Because the special treatment of tuples, they are not automatically
858+
Because of the special treatment of tuples, they are not automatically
855859
converted to an array as a list would be. As an example: ::
856860

857861
>>> z[[1, 1, 1, 1]] # produces a large array

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy