About Lesson
Dtype:- it return the type of elements in the array. i.e. int 64.
import numpy as np arr=np.array([[1.5,2.6,3.4]]) print(“data type is= “,arr.dtype) output data type is= float64 |
itemsize:- it return the length of each element of array in bytes.
import numpy as np arr=np.array([[1,2,3],[5,6,7]]) print(“data type is= “,arr.itemsize, “bytes”) output each item contain= 4 bytes |
Reshape:- the reshape() function associated with the ndarray object is used to reshape the array. It accept the two parameters indicating the row and columns of the new shape of the array.
import numpy as np a=np.array([[1,2,3],[5,6,7],[8,9,6],[4,6,8]]) print(“Original Array is “) print(a) a=a.reshape(3,4) print(“reshaped array is “) print(a) |