9951 explained code solutions for 126 technologies


python-numpyGet array size


import numpy as np
arr = np.array([[1, 2], [3, 4]])
size = arr.sizectrl + c
import numpy as np

load Numpy module for Python

np.array

declare Numpy array

[[1, 2], [3, 4]]

sample matrix data

.size

attribute contains number of elements in an array

size

will contain given array size