Accessing Numpy Object elements

Previous
Next

We can process elements using loops:

import numpy as np
my_list = [10,20,30,40,50]
arr = np.array(my_list)
print("Array element are :")
for ele in arr:
    print(ele)

Numpy Object properties:

  • Array object has properties(dynamic variables)
  • These variables used to find the information of that array object.
  • The properties of object like data type, shape, dimension, size and etc.
import numpy as np
my_list = [10,20,30,40,50]
arr = np.array(my_list)
print("Size :",arr.size)
print("Datatype :",arr.dtype)
print("Shape :",arr.shape)
print("Dimension :",arr.ndim)
Previous
Next

Add Comment

Courses Enquiry Form