NumPy Array Attributes

Python NumPy provides many attributes for arrays, some examples are given below.

Find the dimensions of array

  1. We can use ndim attribute to find dimensions of an array

The above code will output this result

1

Find the dimensions values

  1. We can use shape attribute to find the total number of values in each dimension of an array

The above code will output this result

(10,)

Find the total elements of array

  1. We can use size attribute to find total number of values in an  array

The above code will output this result

10