How to Access Elements From 3-D NumPy Arrays


In this example we will show how to access elements from 3-D NumPy arrays using the array indexing in Python.

Source Code

import numpy as np

n = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])

print('The second element of the first array of the second array:', n[1, 0, 1])

Output:

The second element of the first array of the second array: 6
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments