In this example we will show how to filter and iterate through the NumPy array in Python.
Source Code
import numpy as np
n = np.array([[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]])
for i in np.nditer(n[:, 1:5:2]):
print(i)
Output:
2
4
8
10
In this example we will show how to filter and iterate through the NumPy array in Python.
import numpy as np
n = np.array([[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]])
for i in np.nditer(n[:, 1:5:2]):
print(i)
Output:
2
4
8
10