![Image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguUQfFwyMt4l6mWllp8aSU_EudNliEUB5Oeg-6YNgz2UV9jldAImgZHahh2n9aoMNYgNIIZ_kCbp4iass6E4rni153D4h3n7fpGiu0NpfpGZaZ2-WDs2BoM7Hg5Kvtr-xH5bvFSUMTAvX9/s400/np_reshape.jpg)
Numpy (Continued) Reshape Reshape is when you change the number of rows and columns which gives a new view to an object. import numpy as np a = np.array([(8,9,10),(11,12,13)]) print(a) b = a.reshape(6,1) print(b) -------------------------------------------------------------------------------------------------------------------- Slicing Slicing is basically extracting a particular set of elements from an array. import numpy as np a = np.array([(8,9),(10,11),(12,13)]) print(a[0:2,1]) # 2nd element from the zeroth and first index of the array import numpy as np a = np.array([(1,2,3,4),(3,4,5,6)]) print(a[0:, 2]) Few more example of slicing shown below: --------------------------------------------------------------------------------------------------------------------- linspace returns evenly spaced numbers over a specified interval. #It has printed 10 values between 1 to 3 import numpy as np a=np.linspace(1,3,10)