This shot will discuss some of the most important and widely used attributes of a NumPy array object in Python. These are:
import numpy as np first_array = np.array([1,2,3]) second_array = np.array([[1,2,3],[4,5,6]]) print("Frst array is: :",first_array) print("Second array is: ",second_array) print("\nNo. of dimension of First array: ",first_array.ndim) print("No. of dimension of Second array: ",second_array.ndim) print("\nShape of array First array: ",first_array.shape) print("Shape of array Second array: ",second_array.shape) print("\nSize of First array: ",first_array.size) print("Size of Second array: ",second_array.size) print("\nData type of First array: ",first_array.dtype) print("Data type of Second array: ",second_array.dtype) print("\nItemsize of First array: ",first_array.itemsize) print("Itemsize of First array: ",second_array.itemsize) print("\nData of First array is: ",first_array.data) print("Data of Second array is: ",second_array.data)
RELATED TAGS
CONTRIBUTOR
View all Courses