Week3
Arrays
y=np.array(x,float)
np.zeros()
np.ones()
np.full()
np.eye()
np.random.random()
np.arange(3,7,2)
array.sum/prod/shape/min/max/sorted/mean/unique/dot
array.flatten
np.concatenate((a,b),axis=0)Matrix
np.matrix
matrix.diagonal
matrix.transpose
matrix_power(x,n)==>x**n
npl.svd
npl.cond #check if it is a singular matrix
npl.solve
lstsq
npl.inv
npl.det
npl.matrix_rankDatasets
Exercise
1 - Write a Python program to convert a list and tuple into arrays
2 – Write a Python program to create a 3x3 matrix with values ranging from 2 to 10.
3- Write a Python program to reverse an array (first element becomes last).
4- Write a Python program to convert the values of Centigrade degrees into Fahrenheit degrees.
5 - Write a Python program to find the real and imaginary parts of an array of complex numbers
6 - Write a Python program to find the union of two arrays. Union will return the unique, sorted array of values that are in either of the two input arrays.
7-Write a Python program to create a 2-D array whose diagonal equals [4, 5, 6, 8] and 0's elsewhere.
8-Write a Python program to concatenate two 2-dimensional arrays. Sample arrays:
9-Consider the vector [1, 2, 3, 4, 5], how to build a new vector with 3 consecutive zeros interleaved between each value?
10-Create a null vector of size 10 but the fifth value which is 1
11- Import the ‘Car’ data from following url
Last updated