How to Get Rows of 2-D NumPy Arrays


In this example we will show how to get all the rows of the 2-D NumPy arrays in Python.

Source Code

import numpy as np

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

for row in n:
    print(row)

Output:

[1 2 3 4]
[5 6 7 8]
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments