Check whether a numpy array is empty or not?

Panjeh
Apr 22, 2021

--

Numpy array has .size attribute. If it returns zero it means there are no elements in the array.

Suppose A is a numpy array.

if A.size == 0:
# then A is an empty array

--

--