In this example we will show how to iterate on each scalar element of the NumPy array using the nditer() function in Python.
Source Code
import numpy as np
n = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
for i in np.nditer(n):
print(i)
Output:
1
2
3
4
5
6
7
8