9951 explained code solutions for 126 technologies


python-numpyCount Numpy array elements


import numpy as np
a = np.array([1,1,2,1,2])
count = a.sizectrl + c
import numpy as np

load Numpy module for Python

np.array

declare Numpy array

[1,1,2,1,2]

sample array

.size

attribute contains number of elements in an array