SyntaxFix
Write A Post
Hire A Developer
Questions
You can always take a look at the .size attribute. It is defined as an integer, and is zero (0) when there are no elements in the array:
.size
0
import numpy as np a = np.array([]) if a.size == 0: # Do something when `a` is empty