April 2016
Beginner
156 pages
3h 23m
English
NumPy provides powerful indexing capabilities for arrays. Indexing capabilities in NumPy became so popular that many of them were added back to Python.
Indexing NumPy arrays, in many ways, is very similar to indexing lists or tuples. There are some differences, which will become apparent as we proceed. To start with, let's create an array that has 100 x 100 dimensions:
In [9]: x = np.random.random((100, 100))
Simple integer indexing works by typing indices within a pair of square brackets and placing this next to the array variable. This is a widely used Python construct. Any object that has a __getitem__ method will respond to such indexing. Thus, to access the element in the 42nd row and 87th column, just type this: ...