Skip to content

Commit a3c72d6

Browse files
committed
DOC: Replaced indexing stub doc with routines
1 parent a69e225 commit a3c72d6

File tree

4 files changed

+69
-131
lines changed

4 files changed

+69
-131
lines changed
Lines changed: 66 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,70 @@
1-
.. for doctests
2-
>>> import numpy as np
3-
1+
.. _routines.indexing:
42
.. _arrays.indexing:
53

6-
********
7-
Indexing
8-
********
9-
10-
.. seealso::
11-
12-
:ref:`basics.indexing`
13-
14-
:ref:`Indexing routines <routines.indexing>`
15-
16-
Array indexing refers to any use of the square brackets ([]) to index
17-
array values. There are many options to indexing, which give NumPy
18-
indexing great power, but with power comes some complexity and the
19-
potential for confusion. This section is just an overview of the
20-
various options and issues related to indexing. Further details can be
21-
found in the relevant sections of :ref:`basics.indexing`.
22-
23-
24-
Basic indexing
25-
==============
26-
27-
Basic indexing will be triggered through single element indexing or
28-
slicing and striding.
29-
30-
Single element indexing works
31-
exactly like that for other standard Python sequences but has been expanded
32-
to support multidimensional indexing
33-
for multidimensional NumPy arrays. For more details and examples, see
34-
:ref:`single-element-indexing`.
35-
36-
It is possible to slice and stride arrays to extract arrays of the
37-
same number of dimensions, but of different sizes than the original.
38-
The slicing and striding work exactly the same way it does for lists
39-
and tuples except that they can be applied to multiple dimensions as
40-
well. See :ref:`basic-slicing-and-indexing` for more information and examples.
41-
42-
43-
Advanced indexing
4+
Indexing routines
445
=================
456

46-
Arrays can be indexed with other arrays to
47-
select lists of values out of arrays into new arrays. There are
48-
two different ways of accomplishing this. One uses one or more arrays
49-
of index values. The other involves giving a boolean array of the proper
50-
shape to indicate the values to be selected. Index arrays are a very
51-
powerful tool that allows one to avoid looping over individual elements in
52-
arrays and thus greatly improve performance. See :ref:`advanced-indexing`
53-
for more information and examples.
54-
55-
56-
Other indexing options
57-
======================
58-
59-
:ref:`arrays.indexing.fields`, :ref:`flat-iterator-indexing` are a couple
60-
of other indexing options.
7+
.. seealso:: :ref:`basics.indexing`
8+
9+
.. currentmodule:: numpy
10+
11+
Generating index arrays
12+
-----------------------
13+
.. autosummary::
14+
:toctree: generated/
15+
16+
c_
17+
r_
18+
s_
19+
nonzero
20+
where
21+
indices
22+
ix_
23+
ogrid
24+
ravel_multi_index
25+
unravel_index
26+
diag_indices
27+
diag_indices_from
28+
mask_indices
29+
tril_indices
30+
tril_indices_from
31+
triu_indices
32+
triu_indices_from
33+
34+
Indexing-like operations
35+
------------------------
36+
.. autosummary::
37+
:toctree: generated/
38+
39+
take
40+
take_along_axis
41+
choose
42+
compress
43+
diag
44+
diagonal
45+
select
46+
lib.stride_tricks.sliding_window_view
47+
lib.stride_tricks.as_strided
48+
49+
Inserting data into arrays
50+
--------------------------
51+
.. autosummary::
52+
:toctree: generated/
53+
54+
place
55+
put
56+
put_along_axis
57+
putmask
58+
fill_diagonal
59+
60+
Iterating over arrays
61+
---------------------
62+
.. autosummary::
63+
:toctree: generated/
64+
65+
nditer
66+
ndenumerate
67+
ndindex
68+
nested_iters
69+
flatiter
70+
lib.Arrayterator

doc/source/reference/routines.indexing.rst

Lines changed: 0 additions & 69 deletions
This file was deleted.

doc/source/reference/routines.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ indentation.
3030
routines.fft
3131
routines.functional
3232
routines.help
33-
routines.indexing
3433
routines.io
3534
routines.linalg
3635
routines.logic

doc/source/user/basics.indexing.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
.. _basics.indexing:
22

3-
***************
4-
Indexing basics
5-
***************
3+
****************************************
4+
Indexing on :class:`ndarrays <.ndarray>`
5+
****************************************
66

77
.. seealso::
88

9-
:ref:`arrays.indexing`
10-
119
:ref:`Indexing routines <routines.indexing>`
1210

1311
.. sectionauthor:: adapted from "Guide to NumPy" by Travis E. Oliphant

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