Week3
Arrays
Matrix
Datasets
pd.read_csv
Exercise
1 - Write a Python program to convert a list and tuple into arrays
np.asarray
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).
x = x[::-1]
4- Write a Python program to convert the values of Centigrade degrees into Fahrenheit degrees.
Centigrade values are stored into a NumPy array. Sample Array [0, 12, 45.21 ,34, 99.91]
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.
np.union1d Array1: [ 0 10 20 40 60 80] Array2: [10, 30, 40, 50, 70]
7-Write a Python program to create a 2-D array whose diagonal equals [4, 5, 6, 8] and 0's elsewhere.
np.diagflat
8-Write a Python program to concatenate two 2-dimensional arrays. Sample arrays:
np.concatenate((a, b), 1)
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
Was this helpful?