Practical 2.
1
Aim :- To convert a list of numeric values into a one-dimensional
NumPy array
import numpy as np
l=[10,20,30,40,50,60]
print("List : ",l)
a=[Link](l)
print("Array : ",a)
Output :
Practical 2.2
Aim :- To create a 3x3 matrix with values ranging from 2 to 10.
import numpy as np
x=[Link](2,11).reshape(3,3)
x
Output :
Practical 2.3
Aim :- To append values at the end of an array
import numpy as np
a=[1,2,3]
b=[4,5,6]
c=[Link](a,b)
c
Output :
Practical 2.4
Aim :- To create another shape from an array without changing its
data(3*2 to 2*3)
import numpy as np
a=[1,2,3,4,5,6]
b=[Link](a,(3,2))
print("Reshape 3*2 : ")
print(b)
c=[Link](a,(2,3))
print("Reshape 2*3 : ")
print(c)
Output :