In this tutorial you will learn:
Access NumPy Array
The elements of NumPy Array can be accessed by indexing, it’s very similar to accessing an element in an array. We already know that the index of an array start with zero.
Example
Access a 1-D array is very simple and straight forward we just need to pass the index in square brackets and print the value.
import numpy as np arr = np.array([10, 8, 7, 2]) print("** NumPy Show 1-D array access**”) print("Third element is: ", arr[2])
In order to access 2-D array using
Add new comment