1. initializing NumPy array
import numpy as np
#convert list to array
a = np.array([0, 1, 2])
#Create a 3x3 array of all zeros
b = np.zeros((3,3))
#Create a 2x2 array of all ones
c = np.ones(2,2)
#Create a 3x3 constant array
d = np.full((3,3),7)
#Create a 3x3 array filled with random values
e = np.random.random((3,3))
#Crate a 3 * 3 identity matrix
f = np.eye(3)
#convert list to array
g = np.array([2, 3, 1, 0])
# arange() will create arrays with regularly incrementing values
h = np.arange(20)
i = np.array([[0, 1,2.0],[0,0,0],(1+1j,3.,2.)])
# create an array of range with float data type
j = np.arange(1, 8, dtype=np.float)
# linspace() will create arrays with a specified number of items which are
# spaced equally between the specified beginning and end values
k = np.linspace(2., 4., 5)
# Force a particular datatype
z = np.array([5, 6], dtype=np.int64)
print(z.dtype,k.dtype)