Array Creation: =============== array(): ======= numpy.array(object, dtype = None, copy = True, order = None, subok = False, ndmin = 0) Array creation with specifying of minimum dimension: ==================================================== Syntax: numpy.array(object, ndmin = value) 1-d array: [] 2-d array: [[],[],[],..] 3-darray: [[[],[],[]],[[],[],[]],[[],[],[]],....] import numpy as np a = np.array([1,2,3,4,5],ndmin = 2) b = np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]],ndmin = 4) print(a) print(b) =============================================== shape: ====== ==> an built-in parameter of numpy can be used to get the shape of an array. ==> shape of an array: includes number of rows and number of columns in each row. Syntax: array-name.shape import numpy a = numpy.array([1,2,3,4,5]) b = numpy.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]]) c = numpy.array([[[1,2,3],[4,5,6]],[[1,2,3],[4,5,6]],[[1,3,5],[2,4,6]]]) d = numpy.array([[[[1,2],[3,4]],[[5,6],[7,8]]],[[[9,10],[11,12]],[[13,14],[15,16]]]])# 4d array print("The Shape of array a = ",a.shape) print("The Shape of array b = ",b.shape) print("The Shape of array c = ",c.shape) print("The Shape of array d = ",d.shape) strides: ======== ==> a built-in parameter in numpy can be used to describe that how many number of bytes of memory can traverse to get the next row within the array. Syntax: array-name.strides import numpy a = numpy.array([1,2,3,4,5]) b = numpy.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]]) c = numpy.array([[[1,2,3],[4,5,6]],[[1,2,3],[4,5,6]],[[1,3,5],[2,4,6]]]) d = numpy.array([[[[1,2],[3,4]],[[5,6],[7,8]]],[[[9,10],[11,12]],[[13,14],[15,16]]]])# 4d array print("The Strides value of a = ",a.strides) # number of elements that needs to traverse print("The Strides value of b = ",b.strides) # amount of memory by traversing the number elements print("The Strides value of c = ",c.strides) print("The Strides value of d = ",d.strides) ex: a = [[1,2,3], [4,5,6], [7,8,9]] 3 rows 3 columns 3 X 3 matrix a = [[1,2,3], [4,5,6]] rows = 2 columns = 3 2 X 3 matrix =========================================== NumPy Datatypes: ================ Boolean ==> True/False ==> bool_ Integer Datatypes: ================== ==> the below datatypes can store both +eve and -eve values also ================================================================== int_, int8, int16, int32 and int64 ==> signed datatypes int_ ==> each element of an array can hold the size of int64 (8-bytes) or int32(4-bytes) -128 to 127 ==> 8-bit of integer ==> int8 (-2^8)/2 to (2^8)/2 - 1 -32768 to 32767 ==> 16-bit of integer ==> int16 (-2^16)/2 to (2^16)/2 - 1 (-2^32)/2 to (2^32)/2 - 1 ==> -2147483648 to 2147483647 ==> int32 int64 ==> -(2^64)/2 to (2^64)/2 - 1 ==> the below datatypes can allow to store only positive values: ================================================================ Unsigned numbers ==> can always accept +eve values only. 100 ==> positive -100 ==> negative (with sign) uint8 ==> unsigned integer with 8-bits ==> 0 to 256 uint16 ==> unsigned integer with 16-bits ==> 0 to 65535 uint32 ==> unsigned integer with 32-bits ==> 0 to (2^32)-1 uint64 ==> unsigned integer with 64-bits ==> 0 to (2^64) - 1 ===================================== Floating-point Datatypes: ========================= float_ ==> 64-bits of memory ==> 8-bytes float16 float32 float64 ============================================ Complex Datatype: ================= complex_ ==> can store the memory of 128-bits (16-bytes) complex64 complex128