


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
NumPy which is also called numerical python .
Typology: Study Guides, Projects, Research
1 / 4
This page cannot be seen from the preview
Don't miss anything!



st
ans = np.sum(array) ans = np.sqrt(array) ans = np.square(array) ans = np.add(array A, arrayB) ans = array.T ans = np.max(A) //works for 1D, 2D ans = np.min(A) //works for 1D, 2D ans = np.ceil(array) ans = np.floor(array) ans = np.round(array) ans = array.reshape(r,c) ans = np.ones(n) ans = np.zeros(m)
odd index values with 0. ( use numpy.ones() )
(a) Print the element in the first row, and the first column. (b) Set the element in last row, and the last column to -1 and then print the matrix. (c) Print the elements in the second row. (d) Print the elements in the third column. (e) Replace all the elements in the second row with 0 and then print the matrix.
a) R1 = np.random.random(10, 10) (you may use (2,2) initially) b) R2 = R1 < 0.5 (Print value of R2 and Justify the logic behind it) c) R1[R2] (Print R1[R2] and Justify the logic behind it) d) R1[R2] = -1 (Print R1 and Justify the logic behind it)
a. Add matrices element wise, using np.add(..) It also works with + b. Add 6 to all the elements of the matrix A. c. Double all the elements of the matrix B.
np.add().
Tax Collected at Day 2is 10;