Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

10. Populate a 2-d array of shape (10,15) with Os and 1s chosen randomly. To do this, import the module random first, and use randint(0,1)

image text in transcribed

10. Populate a 2-d array of shape (10,15) with Os and 1s chosen randomly. To do this, import the module random first, and use randint(0,1) to generate a random bit. Use nditer instead of a loop here. 11. You can reshape arrays using the call np.reshape(a, newshape), where newshape is the tuple corresponding to the new shape desired. Generate an array of 24 increasing numbers starting from o using range(24). Reshape it to get the 3-d matrix a. What happens when the tuple newshape is incompatible with the size of a---je, here a has size 24, but what if newshape is (5,5)? 12. The function np.where(condition, x, y) evaluates the condition. x,y are matrices of the same size. If condition is TRUE in a given position, it outputs the corresponding element of x in that position, else y. Take the matrix from Problem 10 above, and replace every occurence of O with -1 using np.where(condition, x, y) by choosing the arguments wisely. 10. Populate a 2-d array of shape (10,15) with Os and 1s chosen randomly. To do this, import the module random first, and use randint(0,1) to generate a random bit. Use nditer instead of a loop here. 11. You can reshape arrays using the call np.reshape(a, newshape), where newshape is the tuple corresponding to the new shape desired. Generate an array of 24 increasing numbers starting from o using range(24). Reshape it to get the 3-d matrix a. What happens when the tuple newshape is incompatible with the size of a---je, here a has size 24, but what if newshape is (5,5)? 12. The function np.where(condition, x, y) evaluates the condition. x,y are matrices of the same size. If condition is TRUE in a given position, it outputs the corresponding element of x in that position, else y. Take the matrix from Problem 10 above, and replace every occurence of O with -1 using np.where(condition, x, y) by choosing the arguments wisely

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions

Question

What attracts you about this role?

Answered: 1 week ago

Question

How many states in India?

Answered: 1 week ago

Question

HOW IS MARKETING CHANGING WITH ARTIFITIAL INTELIGENCE

Answered: 1 week ago

Question

Different types of Grading?

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago