How to Get Shape of a 2-D NumPy Array


In this example, we will learn how to get the shape of a 2-D NumPy array in Python.

Source Code

import numpy as np

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

print(n.shape)

Output:

(2, 5)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Advertisement