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.
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)
In order to access 2-D array