How to Filter and Iterate Through NumPy Array


In this example, we will learn 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
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments