Indexing Arrays
In this lesson, we will learn about indexing and slicing arrays.
We'll cover the following...
Indexing #
Similar to Python lists()
, NumPy arrays can be indexed using square brackets.
Indexing of arrays starts from 0.
Elements of the one-dimensional arrays or vectors are accessed by specifying the index number of the array enclosed within square brackets.
Press + to interact
import numpy as npv = np.array([1, 5, 9])print(v[1])
Elements of the two-dimensional ...