After importing the numpy library, you can use the shape property of NumPy module and the indexing function to obtain the lower bound of the array, and its function signature is as follows:
Copy code
numpy.ndarray.shape
Specific use examples are as follows:
Copy code
Import numpy as np.
a = np.array([ 1,2,3],dtype=np.int32)
Lbound = 0 # defines the lower limit, and the default value is 0.
if(a . ndim & gt; 0):
Lbound = a.shape[0] # Get the length of the first dimension, which is the lower bound.
Print ('LBOUND:', lbound)
In the above code, we first import the NumPy library through the import statement, then define a one-dimensional array A, and then get the lower bound by getting the length of the first dimension from the shape property of the array. When calculating the lower bound, we need to pay attention to the dimension of array and the use of shape attribute and index function.